Javascript - How to get all elements and do same thing on each of them -
i want divs in div(id = room) , same javascript code on each one.
i think should this
get element id room -> divs inside -> on them(change each class "grass")
or using loop.
how that?
please don't use jquery.
modern browsers (ie9+):
var divs = document.queryselectorall('#room div'); [].foreach.call(divs, function(div){ div.classname = 'green'; });
Comments
Post a Comment