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');
}
);