Prototype Dollar Function

By JavaScriptSource Staff on Dec 19, 2005
The dollar function is a simple way to grab an element quickly. It not only takes in strings, it takes objects too.

Instead of: document.getElementById('a');
use: $('a');

If you want a whole collection of elements, you can simply do this: $('a','b',obj,obj2,'c','d');

The JavaScript Source: Snippets : Prototype Dollar Function

Simply click inside the window below, use your cursor to highlight the script, and copy [Control]+C the script into a new file in your text editor (such as Note Pad) and save [Control+S]. The script is yours!!!