Reputation: 11
my Problem is that, when i press the enter Button in any textbox or place in form the cursor Automatically go to create button and press it..... i working in mvc3, so please tell me any solution....
Upvotes: 0
Views: 1113
Reputation: 1039438
You could subscribe to the .keypress()
event of the form and cancel it if it was Enter:
$(function() {
// subscribe to the keypress event of the form
$('form').keypress(function(e) {
if (e.which == 13) {
// if Enter was pressed cancel the default action and
// prevent the form from submitting
return false;
}
});
});
Upvotes: 1