Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Freckle Time Tracking and Every Time Zone and write books like
   Want me to speak at your conference? Contact me!

Prototype gets selector magic

January 18th, 2006

Sam Stephenson doesn’t stop to add new wonders to the Prototype JavaScript framework and the new $$ function that just got added to the Prototype SVN trunk is sure a fine example:

Example: Find all <img> elements inside <p> elements with class “summary”, all inside the <div> with id “page” and hide each matched <img> tag:

$$('div#page p.summary img').each(Element.hide);

Great stuff.