Answers for "find a class in document body js"

0

javascript get class of body

document.body.classList.contains('my-class-name')
Posted by: Guest on April-16-2021
0

how to get class name of element in javascript

var spans = document.getElementsByTagName("span");
for (var i = 0; i < spans.length; i++) {
    if (spans[i].className == 'xyz') {
        spans[i].style.backgroundColor = '#000';
    }
}
Posted by: Guest on July-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language