jquery on form submit 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: when a form is subbmited jquery
$("#myform").submit(function(e) {
})
Example 4: jquery submit form
<input type='button' value='Submit form' onClick='submitDetailsForm()' />
<script language="javascript" type="text/javascript">
function submitDetailsForm() {
$("#formId").submit();
}
</script>
Example 5: submit form jquery browser check
var $myForm = $('#myForm');
if(! $myForm[0].checkValidity()) {
$myForm.find(':submit').click();
}