Topic: How to determine switch state in javascript?

david1 pro asked 6 years ago


Given the example switch:

<div class="switch">
    <label>
      Off
      <input type="checkbox">
      <span class="lever"></span>
      On
    </label>
  </div>
 How can the state of the switch (on/off) be determined via javascript? I would like to use this state to dictate behavior of other javascript functions on the page.

fjch1997 pro answered 6 years ago


How to do this using Knockout?

Bartłomiej Malanowski staff commented 6 years ago

Currently, we don't support Knockout

david1 pro answered 6 years ago


Well typos suck... I was leaving out the ":"
$('#mycheckbox').is(':checked')
 

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags