Get started with bootstrap-switch CDN

Apache Version 2 licensed

Bootstrap-Switch: Free, easy plugin adds switch toggles to Bootstrap checkboxes, radios.

Tags:
  • bootstrap
  • switch
  • javascript
  • js

Stable version

Copied!

How to start using bootstrap-switch CDN


<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.cdnhub.io/bootstrap-switch/3.4.0/css/bootstrap3/bootstrap-switch.min.css">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
    <script src="https://cdn.cdnhub.io/bootstrap-switch/3.4.0/js/bootstrap-switch.min.js"></script>
</head>
<body>
    <div class="container mt-5">
        <h1 class="text-center mb-5">Bootstrap-Switch Example</h1>
        <div class="row">
            <div class="col-md-6 offset-md-3">
                <div class="form-check">
                    <input class="form-check-input" type="checkbox" id="switch1" value="1" data-bootstrap-switch>
                    <label class="form-check-label" for="switch1">
                        Enable auto update
                    </label>
                </div>
            </div>
        </div>
    </div>

    <script>
        $(document).ready(function() {
            $('#switch1').bootstrapSwitch('setState', true);
        });
    </script>
</body>
</html>

All versions