Search
 
SCRIPT & CODE EXAMPLE
 

HTML

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/bootstrap@5.0.0-beta2/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>
Comment

PREVIOUS NEXT
Code Example
Html :: contact us form html send email 
Html :: vue paragraph not showing when class applied to it 
Html :: object.keys not working in angular html 
Html :: bootstrap dropdown 
Html :: href open in new tab 
Html :: is it illegal to hunt polar bears 
Html :: how to select the last type of an element in html 
Html :: input text hint 
Html :: execute vue ui 
Html :: ramda cdn 
Html :: how to use variables in html 
Html :: common web server ports 
Html :: How to play a s3 video url in html video tag? 
Html :: HTML <ins 
Html :: mobile menu bootstrap 
Html :: what are the tags in html that every website have 
Html :: yaml multiline string 
Html :: jspdf html to pdf angular 8 
Html :: How to write the latex in html 
Html :: How many heading tags are there in HTML5? 
Html :: html relative path 
Html :: HTML <figure and <figcaption Elements 
Html :: html year picker 
Html :: tailwind font normal style 
Html :: code highlighter html 
Html :: sample html template 
Html :: Table row indexing 
Html :: Two way binding html templatevue js 
Html :: git compare files with different names 
Html :: html check observable is null 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =