Reputation: 1045
I have a kendo switch which is disabled by default:
<input type="checkbox" id="notifications-switch" aria-label="Notifications Switch" disabled="disabled" />
i have a check box,which is unchecked by default,i want to enabled the switch by checking the checkbox,here is the check box:
<input type="checkbox" id="eq1" class="k-checkbox">
here is what want but does not work,when i check it ,it does not enable the switch:
$("#eq1").change(function () {
if (this.checked) {
$("#notifications-switch").is(":disabled") = false;
}
});
Upvotes: 1
Views: 2388
Reputation: 1045
in kendo in order to achieve the enable disable the follwoing should be use(regarding my question):
$("#notifications-switch").data("kendoMobileSwitch").enable(true);
Upvotes: 1
Reputation: 28513
try this:you need to use prop
to disable the switch. you can use :checked
value to make it disable or enabled
$("#eq1").change(function () {
$("#notifications-switch").prop("disabled",!$(this).is(":checked"));
});
Upvotes: 0