Submitting a Form With jQuery

On a recent project I was working on, I had to have a form submit when the option was changed on a select box. This is a simple task with jQuery. I just had to add a the change() event listener to the appropriate select boxes, and then submit the form. It didn’t work though. The event listener worked, but the form would not submit. I tried several solutions, all pretty much the same in the end. None of them worked, and then I realized that I named my submit button “submit”. It’s a force of habit, something I do without even thinking. It is what caused my solution to break though. “Submit” is a reserved word and it prevented jQuery from submitting my form.

Naming your submit buttons “submit’ is not a good idea anyway. It is a bad habit I have, and will now be broken from this point forth. Remember, if you want to submit your form with jQuery, don’t name your submit buttons “submit”. Better yet, avoid using reserved words at all.