The Prototype-CSS $$() function

The dollar dollar function is Prototype’s CSS Selector Engine. The ‘$$()’ function returns all css match elements. It was used quite same as the CSS selector. For example, to get all tags with the class “myclass”, we use the following:

$$(".myclass")

This function will return the array of elements match the selector string. And We can make the returned elements bold like this:

$$(".myclass").invoke('setStyle', { fontWeight: bold; })

Easy as pie…

July 26th, 2008 by Admin