Answers for "dom element classlist contains"

5

js check for class in classList

element.classList.contains(className);
Posted by: Guest on August-27-2020
0

classlist.contain in javascript

let span = document.querySelector("span");
let classes = span.classList;
let result = classes.contains("d");
if (result) {
  span.textContent = "The classList contains 'c'";
} else {
   span.textContent = "The classList does not contain 'c'";
}
Posted by: Guest on February-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language