JavaScript forms submit gotcha!

I’ve just lost about an hour and a half of my life to a cheeky little JavaScript gotcha. I thought I’d document it here in the vain hope that it didn’t get anyone else.

If you have a button on your form that is named “Submit” then beware! As soon as this button goes into the DOM, it will over-ride the form’s Submit() method, meaning that you can no longer call that from JavaScript or JQuery or whatever you are using.

Make sure you give the button a different name, or even no name at all, for your own peace of mind!икони

Leave a Reply