I'm working in an active form and adding some fields dynamically using a GridView
, but when I have to filter data and I press the enter key (on GridView
to begin filtering) the form is submitted.
How to avoid "submitting" on press Enter key?
I'm working in an active form and adding some fields dynamically using a GridView
, but when I have to filter data and I press the enter key (on GridView
to begin filtering) the form is submitted.
How to avoid "submitting" on press Enter key?
$('#formid').on('keyup keypress', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
return false;
}
});