In order to complete this task, firstly I search the Enter Key code number which is 13. After that I used these
lines in Header section of page.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).keypress(function(e) {
if (e.which == 13 && e.target.tagName != 'TEXTAREA') {
return false;
}
});
</script>
Here in above code I use "TEXTAREA", because Asp.Net TextBox having TextMode="MultiLine" will become type TextArea after rendering into HTML.
Using above jQuery code, it will disable enter key hitting on form but it allow multiline TextBox like Asp.net TextBox to hit enter key within it.
Does not work in Modal Pop Ups
ReplyDelete