Answers for "how to get class element in javascript"

1

javascript get class name

document.getElementById("myDIV").className = "mystyle";
Posted by: Guest on April-07-2021
1

javascript document object model getElementsByClassName

document.getElementsByClassName('test')
Posted by: Guest on August-13-2020
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 "how to get class element in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language