CheckBoxFor data toggle on change event not working ? Jquery

i am trying to use this jquery code for alerting on change if checked true,

 $("#NSupport").change(function () {
            var tid = this.id;

            if ($(this).is(":checked")) {
                alert("inside");
            }
        });

here is my check box,

@Html.CheckBoxFor(model => model.NSupport, new { data_toggle = "toggle",data_width = "100", data_on = "yes", data_off = "No", data_offstyle = "info" })

Can any one has idea why it is not calling jquery function?

BR

EDIT,

I just use this code in which it is alerting "dad" but only on page load,

  $('#NSupport').toggle(
            function () {
                $('.check').attr('Checked', 'Checked');
                alert('mom');
            },
            function () {
                $('.check').removeAttr('Checked');
                alert('dad');
            }
        );

85 thoughts on “CheckBoxFor data toggle on change event not working ? Jquery”

  1. 279020 152784Looking forward to move into an additional hous?! […]Real estate busines is getting a lot more and far more less protitable, take a look at why[…] 453615

    Reply

Leave a Comment