Answers for "javascript button toggle on off"

0

javascript button toggle on off

<div class="form-check form-switch"> <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
const btn = document.querySelector(".form-check-input")
label = document.querySelector(".form-check-label");
btn.addEventListener("change", function() {
    this.checked ? label.innerHTML = "Button Turned On" :
        label.innerHTML = "Button Turned Off"
});
</script>
Posted by: Guest on July-18-2021

Code answers related to "javascript button toggle on off"

Browse Popular Code Answers by Language