Hi all,
I am New in Javascript and Not Having too Much Knowledge of Javascript. I Have a Javascript That Disable Enter Key in Textarea in Whole Form in Page. but I Want to Disable Enter Key only One Textarea.
Below is my Code:
<html>
<head>
<title>The Title Of Your Page Goes Here!</title>
</head>
<body>
<script language="javascript" type="text/javascript">
function checkCR(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = checkCR;
</script>
<p><center><form action="" method="post">
Enter Your Number<br><textarea cols="40" rows="5" name="field1" wrap="physical"></textarea><br>
Enter Your Message<br/><textarea cols="40" rows="5" name="field2" wrap="physical"></textarea>
<input type="submit" value="Send it!"><input type="reset" value="Clear it!" />
</form></center></p>
</body>
</html>
The Above Code Work Fine but This Disable The Enter Key in Twice Textarea but I Want to Disable Enter Key Only in First Textarea That is "field1".
Please Help Me.
Thank You.