Answers for "how to get class name of element in javascript"

3

how to get element by class name javascript

document.getElementsByClassName("legend").style.display="none";
Posted by: Guest on June-27-2020
1

javascript get class name

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

get name of class javascript

myObj.constructor.name
Posted by: Guest on December-19-2020
1

how get class name

String className = this.getClass().getSimpleName();
Posted by: Guest on February-05-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 "how to get class name of element in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language