Code:
function themeOne() {
var thm = document.querySelectorAll("div.articles");
for( i = 0; i < thm.lenght; i++)
document.thm[i].style.border = "5px solid red";
}
So all I'm trying to do here is to change the styles of the div's that have a class attribute with the value "articles". The function call works and a NodeList is created and placed in the variable
thm. But before the first pass of the for loop, firebug is telling me that
thm is undefined.
You can see in the picture below that
thm was infact defined and the NodeList was properly created and placed in the variable.
Can someone tell me why
thm is being returned undefined?
querySlectorProblem by
FutureWebDev, on Flickr