Bootstrap - How to make toggle buttons

 At least, you need to have Bootstrap 5 or higher version.

The code below will insert Default toggle button. Actually, it is checkbox.

<input type="checkbox" class="btn-check" id="default" autocomplete="off">
<label class="btn btn-outline-success" for="default">Default</label>

And also you can change the color of button by label class.

It has checkbox behavior. It means, when it is checked, the toggle button switches own state.

So, you can just change checkbox status by 'checked' attribute as usual, and toggle button show this as well.

Comments

Popular posts from this blog

CSS Как прикрепить слой (div) к краю

MySQL - How to add JSON column type

Как сделать заголовок модуля активной ссылкой в Joomla 1.5