Search code examples
javascriptprototypejs

Prototype Hide All elements of a class


I can show/hide with IDs, however how do I do it with classes?

$('black').setStyle({
  display:'none', border:'1px solid red'
});

For example that will work if I had #black, but what if I have .black?

Thanks,


Solution

  • Got it!

    $$('.black').each(
       function (e) {
          e.setStyle({border:'1px solid red'}); 
       } 
    );