jQuery and Form Submit Breaking

May 10th, 2012

If you intercept the form submit with some jQuery and find that you can’t trigger the submit yourself with your script, you may need to check the name of your submit button. If you have a submit button named submit, jQuery will not be able to submit that form. You may also see the error “Uncaught TypeError: Property ‘submit’ of object # is not a function”.

The fix is simple of course. Change the button name.

Wrong: [code]<input type="submit" name="submit" id="confirm" value="Confirm">[/code]
Right: [code]<input type="submit" name="confirm" id="confirm" value="Confirm">[/code]

Hope that helps someone else.

WordPress - Entries (RSS) and Comments (RSS) - © 2011 Ben Dauphinee