jQuery form submit method doesn’t work

This one is quirky. If you've checked your Error Console, examined your code to make sure the proper element is being used and have done every other troubleshooting tactic out there, then the answer is probably the following:

You can't assign the submit button name attribute equal to "submit".

Crazy, right. Well, see for yourself!

<form action="">
   <input type="submit" value="blah" name="submit" />
</form>

<form action="">
   <input type="submit" value="blah" name="othername" />
</form>

$('form input').submit();

You'll be amazed to find that only the second form will submit.

Why follow me on Twitter?

  • I tweet about new technologies, services or libraries I find interesting
  • Yeah, sometimes I'll post a pet-peeve or rant about something trivial
  • If I discover something that made my web development life easier, I share it
  • I'll shout out any handy tip that I think might be useful to other devs


Tagged .

Updated: 2011-12-27

Phil LaNasa follow us in feedly