Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use switch in bootstrap

Shulou Source: shulou.com Published: 2022-06-02 04:53:12 10月03日 Update

This article introduces the knowledge of "how to use switch in bootstrap". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In bootstrap, switch is used to style the selection box similar to the switch and is the bootstrap plug-in that implements the check box beautification switch with the calling syntax of "$(selection box element). BootstrapSwitch ();".

Operating environment of this tutorial: Windows7 system, bootstrap3.3.7 version, DELL G3 computer

What is the use of switch in bootstrap

Bootstrap Switch is a switch control realized through check box beautification, which can set a switch-like style to the selection box. It is a plug-in that depends on Bootstrap.

download

Official website address: https://www.bootcdn.cn/bootstrap-switch/

GitHub download address: https://github.com/Bttstrp/bootstrap-switch

Import

Use

/ / define a selection box / / apply a style to the selection box $("[name='test']") .bootstrapSwitch ()

Attribute

Commonly used attributes:

Size: switch size. Available values include mini, small, normal, and large

OnColor: the color of the open button in the switch. Available values include primary, info, success, warning, danger, default

OffColor: the color of the off button in the switch. Optional values primary, info, success, warning, danger, default

OnText: the text of the open button in the switch. The default is ON.

OffText: the text of the off button in the switch. Default is OFF.

OnInit: the event that initializes the component.

OnSwitchChange: the event when the switch changes.

Data-on-color/ data-off-color: primary dark blue, info light blue, success green, warning yellow, danger red

Detailed introduction:

This is the end of the content of "how to use switch in bootstrap". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Select button style event content address attribute plug-in text more knowledge color Zhongguan check box practical learned next element dilemma size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn Microsoft Docker Huawei