Property ‘submit’ of object # is not a function

Check the form to see whether there is a HTMLInputElement with id or name is submit.

This will set a property submit to the HTMLFormElement, so the submit function which is in the prototype of the form element can’t be executed.

Example:

<form class="form" id="form" action="/mailer.php" method="post">
    ​<input type="button" name="submit" value="go"/>
</form>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

js:

​console.log($("#form")[0].submit)​;​  // will be the button element, not the submit function.

jQuery’s .submit() method will call the .submit() on the original dom element, so the error will happen.

Leave a Comment