Jquery - Form Submits Before Alertify Receives Confirm Box Value (with Html5)
I have a form with 2 fields, one of which is required. I used HTML5 required attribute to check if the field is filled up during submission.
Solution 2:
I modified the example above to reduce the boilerplate. No need for the bounds check override anymore. Just pass the event and message to the generic confirm() method.
$(document).ready(function () {
functionconfirm(event, msg) {
var evt = event;
event.preventDefault();
alertify.confirm(msg, function (e) {
if (e) {
evt.currentTarget.submit();
returntrue;
} else {
returnfalse;
}
});
}
$("#deleteApplianceForm").submit(function(event){
confirm(event, "Are you sure you want to delete this appliance?");
});
});
Post a Comment for "Jquery - Form Submits Before Alertify Receives Confirm Box Value (with Html5)"