Bootstrap toggle-switch is a simple component used for activating one of the two given options. Commonly used as an on/off button.
- Bootstrap has an inbuilt data-toggle attribute that is used for toggling Bootstrap elements.
- Here bootstrapToggle() method is used for performing the task. The bootstrapToggle() method enables the toggling of the switch. If the switch is disabled and the user clicks the checkbox then it toggles to an enabled state. If the checkbox is in the enabled state then the bootstrapToggle() method toggles it to the disabled state.
- Here, the toggleOn() method toggles on the switch whereas toggleOff() method toggles off the switch.