I have a form with several submit buttons. I want my last button to handle the submit rather than the HTML5 spec’ed first button.
I can’t change the html at this point and am fairly sure this requires JS. But when I’ve given it a shot I’ve gotten into nasty loops or dead code trying to prevent default behaviour and then fire my other button.
Has anyone done this before? jQuery is on the page if needed.
Thanks,
Denis
Since you mentioned jQuery 🙂
If all you want to do is submit your form when a user presses the enter key, then
However, if you have different behavior/forms depending on which button is clicked and you want the enter key to trigger your last button’s click event, then