disable or enable switch using check box

1 Answer 1372 Views
Switch (Mobile)
morteza
Top achievements
Rank 1
morteza asked on 21 Aug 2018, 12:39 PM

I have a check box and kendo switch,i want the switch to be disabled by check the checkbox and enabled by un-check the checkbox,i think 4 years back this was a question and as it was answered at the time,should be able to do so,any way here is the code:

 

  
      <input type="checkbox" id="eq1" class="k-checkbox"> 
     <label>Crew Present:</label><input type="checkbox" id="notifications-switch" aria-label="Notifications Switch" disabled="disabled" />
      <label>Grid Loss:</label><input type="checkbox" id="notifications-Grid" aria-label="Notifications Switch" disabled="disabled" />

here is the JS:

 

 $(function () {
          $("#notifications-switch").kendoMobileSwitch();

          //$("#notifications-Grid").kendoMobileSwitch();

      });


      $("#eq1").change(function () {
          debugger;
          $("#notifications-Grid").prop("disabled", !$(this).is(":checked"));
      });

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 23 Aug 2018, 07:40 AM
Hello,

Here's a dojo example showing how you can disable/enable a Switch on checking/unchecking a checkbox, by calling the Switch's enable API method.

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Switch (Mobile)
Asked by
morteza
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or