jQuery: $(’#formID’).submit() issue
I ran across a strange conflict today while working with jQuery and a form. My form was doing nothing when I called the jQuery .submit(); function — no errors, but no submit. My code:
$('input.saveApplication').bind('click', function() {
... other code ...
$('#application').submit();
});
The issue was caused by having an element with ID ’submit’:
<input type='submit' id='submit' value='Submit'>
Once I realized what was happening it made sense but it wasn’t immediately intuitive to me. If you have this error double check your IDs and rename as needed!


Ben, you crack me up! You descend from very plain English and beautiful photos to gibberish that would take me about a year to decipher! What a talented and wonderful brother (and man) you have turned out to be. I love you!
Comment by Gen — March 15, 2009 @ 10:40 pm
was having the exact same problem, this seems to have fixed it…you’re a life-saver
Comment by Rafael — July 1, 2009 @ 10:45 am
Awesome! Thanks Ben! Regards Ben
Comment by Ben — July 28, 2009 @ 1:17 am
in my case i had input with name=’submit’ and i had exactly the same issue.
Thx for your post. Now i know it’s nothing wrong with my brain =P
Comment by Aaron — November 3, 2009 @ 5:16 am
Whew, thanks for finding this bug! I was going crazy for a while. Did you submit it yet for fixing??
Comment by David — November 18, 2009 @ 9:58 am
Thanks for the info….
Comment by Silai — December 9, 2009 @ 8:14 pm
You are a SAINT. I spent almost 6 hours tearing my asynchronous, JQuery’d-to-hell, brain-melting form to pieces to try and find the bug in code that I KNEW worked. I, too, had the NAME of the input field =”submit”. Why didn’t I google sooner? * sigh * Thank you, sir. You are a gentleman and a scholar.
Comment by Scotty — January 23, 2010 @ 1:25 am
Dang…an hour down the tubes after adding IDs to all my form elements so the labels could be clicked on…including the submit button…which caused this issue. You’d think it would throw some sort of error. Thanks for posting this!
Comment by Mike — February 24, 2010 @ 3:35 pm