I've tried a few suggestions from this site on preventing SUBMIT when the user presses the ENTER key on a form, but they don't seem to work. I'm either not putting the SCRIPT in the correct place or maybe it's because I'm using a MODAL?
Here's one of the scripts I tried:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js">
$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
</script>
I've put the code after the FORM tags, nested it in the BUTTON SUBMIT tags. Where am I going wrong? The form is a simple form with inputs and selects with some PHP to populate the select tags.
<script>//your code</script><script src="/path/to/jquery.js"></script>then another like<script>$(document) //rest of code</script>- keeps the code clean and easier to manage :)