I have a form with action="autosave.php". This saves as normal when enter is clicked or the submit button is pressed.
<input type="submit" id="save" value="Save Changes" />
I am also using jquery autosave, which automatically submits the form every 10 secs
$('form.checklist').autosave({interval:10000,......});
My problem is, i want to put jquery validation on the form, but i dont want it to validate for any any the above 3 processes.
I only want the validation to take place when a button is clicked.
<button class="ui-state-default ui-corner-all" onclick="location.href='submit.php'" type="button">Submit</button>
Any help would be appreciated. Thanks in advance
<button id="submit" class="ui-state-default ui-corner-all" type="button">Submit</button>
<script>
$('#submit').click(function(e){
dovalidation (obviously this must be your validation function)
if(validation==true){
location.href='submit.php';
}else{
e.preventDefault; return false;
}
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.