vendredi 11 septembre 2015

How can I set a checkbox to unchecked when I click cancel

I have a bootbox script that displays a custom alert. When clicking cancel I need the checkbox that fires the alert to go back to unchecked.

This is my checkbox when checked

<div class="checkbox">
     <label>
     <input type="checkbox" id="enroll-deposit" checked="" data-original-title="" title="" value="True"> I am not enrolling in Direct Deposit
     </label>
</div>

and this is my bootbox script thats fired on click

$(document).on("click", "#enroll-deposit", function(e) {
    var val = $(this).val();
    if (val == "True") {
        var url = "@Url.Action("waivetask", "OBProcess" , new { id=ViewBag.DocId, tid=ViewBag.TaskId })";
        var desc = "Direct Deposit";
        bootbox.dialog({
            message: "Are you sure you want to waive " + "<strong>" + desc + "</strong>",
            title: "Waive Direct Deposit",
            buttons: {
                main: {
                    label: "Cancel",
                    className: "btn-default",
                    callback: function() {
                        //NOT SURE WHAT TO PUT
                    }
                },
                danger: {
                    label: "Waive and Move On to Next Task",
                    className: "btn-danger",
                    callback: function() {
                        window.location.href = url;
                    }
                }
            }
        });
    }
});

I am not sure what to do when the user clicks the cancel button. I want to uncheck the enroll-deposit box.




Aucun commentaire:

Enregistrer un commentaire