Kendo switch change event using jquery

Viewed 1451

is there any way ,to get the Change event of kendo switch with jquery?

<input type="checkbox" id="tst" aria-label="Notifications Switch"  />

the following does not work:

$("#tst").change(function(){
 alert("works");
});
2 Answers

for dynamic elements you should use like this

$(document).on('change',"#tst",function(){
 alert("works");
});

Some kendo controls, due to the way they are rendered, require the event to be placed on their data object. This will fix your code.

$("#tst").data("kendoSwitch").bind("change", function () { alert("works"); });

Related