I am trying to prevent unintended submissions of a form when the Enter key is accidentally pressed. I tried in abject futility to block the Enter key - code 13 and 10 - so am revisiting a simple confirmation popup. The code I have works - if Enter is pressed or Submit button clicked, it does create a pop-up. If I click OK, it submits the form as expected. But if I click Cancel, it hangs the form altogether. Displays a faded version of the form and all data typed in it, that is completely unresponsive. The only way to get the form to work again is to refresh the document, which deletes everything entered. Any ideas? Here are two options I tried - both exhibits identical results:
jQuery('#display-section1').submit(function() {
var status = confirm("Click OK to Submit?");
if(status == false){
return false;
} else {
return true;
}
});
jQuery(document).submit(function() {
var status = confirm("Click OK to Submit?");
if(status == false){
return false;
} else {
return true;
}
});