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

Idea PhpStorm - How to fix bugs with incorrect code Inspections and Autocomplete

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

PHP - How to show expected return array elements