Skip to content Skip to sidebar Skip to footer

Confirm Box Return Value From Alertify Plugin And Jquery

I have a confirm dialog for my form. it is inside a jquery submit function. I am using alertify to show the confirm dialog. But problem is my jquery submit function returns before

Solution 1:

One work around would be to used a button rather than a submit input, then use a click listener to run alertify. This could then submit your form via jQuery. Here's how it might look:

HTML:

<form id="form">
    <input type="button" value="Submit"id="btn">
</form>

JavaScript:

$('#btn').click(function() {
    alertify.confirm("Delete the selected entry?",function(e){
        if(e) {
            $('#form').submit();
            returntrue;
        } else {
            returnfalse;
        }

    });
});

Post a Comment for "Confirm Box Return Value From Alertify Plugin And Jquery"