I have an issue with JQM, when if I hit enter, it submits all the forms instead of active one, so I wrote this code to disable ENTER key for all the forms:
$('body').keypress(function (evt) {
var charCode = evt.charCode || evt.keyCode;
if (charCode == 13 && !$(evt.target).is("textarea")) { //Enter key's keycode
return false;
}
});
but how to disable a keypress for all the forms, but a current one? let say it has id=”activeOne”. So I want to work Enter to for for activeOne, but not other? Thanks
You can try this. On every form click or keypress event just set the form id into a variable and check for that inside
bodykeypressevent and act accordingly.