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

The Form $F() function

the $F() function will returns the value of form element.

$F("form_element_id")

Does it need a description anymore??

July 25th, 2008 by Admin

The Prototype $() function

The dollar function is one of the Prototype Utility Function. $() is the most frequently used prototype’s function. basically it was used to refer an element in the HTML page. The function is quickly shorthand for getElementById.

The usual function identifying an element is:
document.getElementById("element_id")

The $() function reduces the code to:
$("element_id")

For example, you can set the CSS text color with this code:
$("element_id").style.color = "#ffffff";

Or, the “Prototype way”:
$("id_of_element").setStyle({color: '#ffffff'});

July 20th, 2008 by Admin