jquery submit form on button click code example
Example 1: jquery submit form
$('form').submit();
$('form').submit(function(e){
e.preventDefault();
e.currentTarget.submit();
});
Example 2: jquery enable submit button
$("#submitButtonID").prop('disabled', true);
$("#submitButtonID").prop('disabled', false);
$("#submitButtonID").attr('disabled','disabled');
$("#submitButtonID").removeAttr('disabled');
Example 3: when a form is subbmited jquery
$("#myform").submit(function(e) {
})
Example 4: jquery on form submit call function
$(document).ready(function() {
$("your form selector here").submit(function() {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize(),
success: function() {
$('.simple-sucess').fadeIn(100).show();
$('.contact_form').fadeOut(100).hide();
$('.simple_error').fadeOut(100).hide();
}
})
})
})
Example 5: jquery submit form
<input type='button' value='Submit form' onClick='submitDetailsForm()' />
<script language="javascript" type="text/javascript">
function submitDetailsForm() {
$("#formId").submit();
}
</script>