Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get element by class

var x = document.getElementsByClassName("example");
var i;
for (i = 0; i < x.length; i++) {
  x[i].style.backgroundColor = "red";
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #element #class
ADD COMMENT
Topic
Name
3+5 =