karthik80c
asked on
Jquery form submit not working ?
ASKER
Hi Mukesh
Throws Uncaught TypeError: $(...)[0].submit is not a function(…)
Throws Uncaught TypeError: $(...)[0].submit is not a function(…)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the info @Kim Walker . It's Works . Please tell the reason . So that I can easily remember
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
All the input elements in your form are sub-elements of the form in the DOM. If you have a form named "myform" with an element named "address", the DOM path to that element is document.myform.address.
The form prototype, and thereby all forms, contain a method called "submit" which gathers all the values of the sub-elements and sends them to the server for processing. The DOM path to the submit method is document.myform.submit(). Because it is a method, it is followed by a set of parentheses. However, if you add an input element named "submit" to the form, the path to that element becomes document.myform.submit and replaces the method at document.myform.submit().
Although the form can still be submitted by the natural behavior of a submit button, any attempt to submit the form otherwise by the submit() method will invoke an error. If you invoke the preventDefault() method to override the submit button's natural behavior, the form cannot be submitted at all.
A similar situation occurs in jQuery where the jQuery object's prototype submit method will be replaced by the submit input element.
The form prototype, and thereby all forms, contain a method called "submit" which gathers all the values of the sub-elements and sends them to the server for processing. The DOM path to the submit method is document.myform.submit(). Because it is a method, it is followed by a set of parentheses. However, if you add an input element named "submit" to the form, the path to that element becomes document.myform.submit and replaces the method at document.myform.submit().
Although the form can still be submitted by the natural behavior of a submit button, any attempt to submit the form otherwise by the submit() method will invoke an error. If you invoke the preventDefault() method to override the submit button's natural behavior, the form cannot be submitted at all.
A similar situation occurs in jQuery where the jQuery object's prototype submit method will be replaced by the submit input element.
ASKER
Thanks @Kim Walker For detailed Explanation
$("#educationMyForm")[0].s