05 September 2016
tags:
html
javascript
jquery
Should have known this for a long time now. If either
or
exist inside a form tag, enter key will automatically send the form.
Incidentally, you can capture the form before it is sent using jquery:
$('#myForm').submit(function(e){ /* do things here */ //e.preventDefault() //or //return false //to prevent form submitting all together. })