I want to validate my form using javascript before submitting it. I validated all fields successfully but my form is not getting submitted.
Asked
Active
Viewed 832 times
-3
-
here is my code – darshana May 15 '17 at 10:54
-
– darshana May 15 '17 at 10:55
-
Please provide more details such as the HTML and javascript files – Akshay Venugopal May 15 '17 at 10:55
-
Do you return "true" in the function "formValidation()"? – Remco K. May 15 '17 at 10:55
-
Please add your code in your answer itself instead of in comments. – Mohit Bhardwaj May 15 '17 at 10:56
-
1Please go read [ask], and provide all relevant code in the question. – CBroe May 15 '17 at 10:56
-
– darshana May 15 '17 at 10:57
-
1You should use the edit-button to add code into the question instead of adding it as comments – Mangs May 15 '17 at 10:58
-
Possible duplicate of [How to submit a form using javascript?](http://stackoverflow.com/questions/9855656/how-to-submit-a-form-using-javascript) – evolutionxbox May 15 '17 at 11:08
1 Answers
0
Pure Javascript
you can use the HTML DOM submit()
function:
document.getElementById("myForm").submit();
Read more about the function here: https://www.w3schools.com/jsref/met_form_submit.asp
With Jquery
$("#myForm").submit(/* Callback */);
Read more about the jquery function in the documentation: https://api.jquery.com/submit/

Rishi
- 399
- 6
- 23