j-ulrich / jquery-simulate-ext

jQuery simulate extended
https://j-ulrich.github.io/jquery-simulate-ext/
Other
146 stars 48 forks source link

Trigger submit event when pressing enter on form field #14

Open ragulka opened 10 years ago

ragulka commented 10 years ago

Closes #13

I realized that triggering the submit event is the way to go instead of trying to call submit() on the form itself. The latter would result in submitting the form but no way to catch the event, because it triggered no events.

It also takes into account when even.preventDefault() is called on the keydown event to prevent submit from happening.