Answers for "change style by getelementby tag name"

0

change style by getelementby tag name

var x = document.getElementById("myDIV");
var y = x.getElementsByTagName("P");
var i;
for (i = 0; i < y.length; i++) {

    y[i].style.backgroundColor = "red";
}
Posted by: Guest on August-16-2021
0

change style by getelementby tag name

var x =
 document.getElementById("myDIV");
x.getElementsByTagName("P")[1].style.backgroundColor = "red";
Posted by: Guest on August-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language