|
Helping ordinary people create extraordinary websites! |
Top 10 Custom JavaScript Functions Of All TimeBy Dustin Diaz2006-08-22
8) getElementsByClass() Originially written by nobody in particular. Several developers have implemented their own version and no one single version has proven to be better than another. As you might expect, my humble self has even had a crack at it. This function was spawned from developers needing a quick and elegant way of grabbing elements by a className and to a developer’s surprise, it’s not an original DOM method as one might think…afterall, we have getElementsByClass by Dustin DiazSimply add a class name to the beginning of the funciton and the 2nd and 3rd arguments are optional and the magic is done for you! Tutorial Pages: » Top 10 custom JavaScript functions of all time » 10) addEvent() » 9) addLoadEvent() » 8) getElementsByClass() » 7) cssQuery() » 6) toggle() » 5) insertAfter() » 4) inArray() » 3, 2, & 1) getCookie(), setCookie(), deleteCookie() » Last but not least, a bonus function: The Prototype Dollar Function » And so will they all… |
|