Home JQuery How to submit an HTML Form using JQuery?
 
 
 

How to submit an HTML Form using JQuery?

PDF Print E-mail

Question: How to submit an HTML Form using JQuery?

 

Answer:

For example you have a form with id "myform"

<form id="myform" action="submit.php">
  <input type="text" value="This is a test form" />
  <input type="button" id="mybutton" value="Save" />
</form>

Now  when the button with id "mybutton" is clicked we want to submit the form using the JQuery submit() function which executes each time the specified event is triggered. The code looks like the below

 
<script type="texxt/javascript">
$('#mybutton').click(function() {
  $('#myform').submit();
});
</script>
 

Now whenever the Button with  id "mybutton" is clicked the form will submit to the submit.php page.

+/-
+/- Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
Security Please input the anti-spam code that you can read in the image.
 

Go Daddy $7.49 .com Sale!