Checkbox in sweet alert is not getting clicked

875 Views Asked by At

I am using sweetalert in MVC project, and rendering checkbox in to sweetalert using CheckBoxFor html helper. But when I clicked on these checkboxes, sometime it is getting clicked and sometime it is not getting clicked. I am not getting the reason behind this weird behaiviour.

And at the same place I tried adding normal html checkboxes, these checkboxes are working perfectly fine.

Can anyone help to know the reason behind this weird behaiviour ?

Code:

View:

<table class="table">
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    <input type="checkbox" name="Asha" style = "display:block;height:20px;width:20px;"/>
                </td>
                <td style="padding-left:20%">
                    @Html.CheckBoxFor(modelItem => item.Status,htmlAttributes: new { style = "display:block;height:20px;width:20px;", id = item.Id ,Class = "process-to-lock", value = item.Name})
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
            </tr>
        }

    </table>

SweetAlert:

$("#unLockNominations").click(function (e) {
        showCustomLoader();
        $.ajax({
            type: 'GET',
            url: '@Url.Action("UnlockNomination", "Review")',
            dataType: 'html',
            success: function (result) {
                hideCustomLoader();
                swal({
                    title: "Awards to unlock",
                    html: true,
                    text: result,
                    showConfirmButton: ($(result).filter('#no-awards').text() == undefined || $(result).filter('#no-awards').text() == ""),
                    confirmButtonColor: "#0070b9",
                    confirmButtonText: "Submit",
                    showCancelButton: true,
                    cancelButtonText: "Cancel",
                    closeOnConfirm: false,
                    closeOnCancel: true
                }
}

Here in above code text renderd in sweet alert is a html table which I mentioned above.

0

There are 0 best solutions below