Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

checkbox event listeners

const checkbox = document.querySelector("input[name=checkbox]");

checkbox.addEventListener("change", (e) => {
  if (e.target.checked) {
    console.log("Checkbox is checked..");
  } else {
    console.log("Checkbox is not checked..");
  }
});
Source by thewebdev.info #
 
PREVIOUS NEXT
Tagged: #checkbox #event #listeners
ADD COMMENT
Topic
Name
6+3 =