submit button jquery code example
Example 1: jquery submit form
$('form').submit();
$('form').submit(function(e){
e.preventDefault();
e.currentTarget.submit();
});
Example 2: put form action jquery
$('#button1').click(function(){
$('#formId').attr('action', 'page1');
});
$('#button2').click(function(){
$('#formId').attr('action', 'page2');
});
Example 3: 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();
}
})
})
})