Search code examples
javascripthtmlcssprototypejs

Change style of all elements of a class via prototype javascript


This is probably really simple, but the prototype docs on the $$(function) really suck. What do I DO with all the items once the function gives them to me?

First I tried:

$$('div.category').style.height = 400 +"px";

Then:

$$('div.category').each(.style.height = 400 +"px");

Finally:

for (x in $$('div.category'))
{
    x.style.height = 400 +"px";
}

None of them are working. Help?


Solution

  • $$('div.category').each(function(d){
        d.style.height = '400px';
    });