What should be the code here if the user clicks the back button after submitting form, data must be reset.
Here is my code so far:
$('form').on('submit',function(){
} else{
}
});
What should be the code here if the user clicks the back button after submitting form, data must be reset.
Here is my code so far:
$('form').on('submit',function(){
} else{
}
});
$('form').on('submit',function(){
//YOUR ACTION GOES HERE
$('#YOURFORMID')[0].reset();
} else{
}
});
Form submit after response with add this line and form id
document.getElementById("formID").reset();
$(':input','#myform')
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected');
Or
$('#myform')[0].reset();