Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate form's submission with jQuery?

I've a form on my ASP.NET web page. There is submit button also. I've some validation logic attached to client-side click event of a button. I'd like to submit this form from my jQuery validation logic, how to achieve this?

like image 562
rafek Avatar asked Jun 02 '09 13:06

rafek


People also ask

How can we submit a form using jQuery?

Forms can be submitted either by clicking an explicit <input type="submit"> , <input type="image"> , or <button type="submit"> , or by pressing Enter when certain form elements have focus.

How do I automatically submit a form without clicking?

Submit a Form Using JavaScript The most simple way to submit a form without the submit button is to trigger the submit event of a form using JavaScript. In the below example we are going to create a function to submit a form. We will set that function at onclick event of a div tag.

How do you check form is submitted or not in jQuery?

$("#something-%"). submit(function(e) { e. preventDefault(); $("#some-span"). html(data); });

Why form is not submitting in jQuery?

The NUMBER ONE error is having ANYTHING with the reserved word submit as ID or NAME in your form. If you plan to call . submit() on the form AND the form has submit as id or name on any form element, then you need to rename that form element, since the form's submit method/handler is shadowed by the name/id attribute.


1 Answers

Assuming your form had an id of "myform" the following jquery would cause it to be submitted.

$("#myform").submit(); 
like image 146
JohnRudolfLewis Avatar answered Nov 15 '22 07:11

JohnRudolfLewis