getElementsBy*

Posted
14 January 2008
Tagged
Site

So, it’s been nearly two years, and I’ve finally decided to close getelementsby.com, mainly because I want to consolidate all my web projects into one place (this place). to make it easier to manage, and get everything under one roof. But don’t worry, the entire list of functions is still available (below), and I also intend to make a major update soon. Until then, here’s what’s left of getelementsby.com:


Hey. This is a handy reference for all the various getElementsBy* JavaScript functions that are out there, from the DOM standard getElementById to the very advanced getElementsBySelector functions. I’ve put this together because it’s near impossible to write any useful scripts that use the DOM without these functions, and its nice to know the different methods available.

getElementById

getElementById

W3C
All browsers supporting DOM Level 1

$

Sam Stephenson (Prototype JavaScript framework)
This is an alias of getElementById by W3C.
All browsers supporting DOM Level 1

getElementsByName

getElementsByName

W3C
All browsers supporting DOM Level 1

getElementsByTagName

getElementsByTagName

W3C
All browsers supporting DOM Level 1

getElementsByTagNames

getElementsByTagNames

Peter-Paul Koch
Not only returns an array of elements, also returns them in the order they appear in the document.
IE/Win 6+, Firefox 1.5+ *

getElementsByClassName

getElementsByClassName

Sam Stephenson (Prototype JavaScript framework)
IE/Win 6+, Firefox 1.0+, Mozilla 1.7+, Safari 1.2+

getElementsByClassName

Stuart Colville
IE/Win 5+, IE/Mac 5.2+, Firefox 1.0+, Opera ?, Safari ?

getElementsByClassName

Robert Nyman
IE/Win 5+, Firefox 1.5+ *

getElementsByClassName

Jonathan Snook
IE/Win 6+, Firefox 1.5+ *

getElementsBySelector

cssQuery

Dean Edwards
IE/Win 5+, IE/Mac 5.2+, Firefox 1.0+, Mozilla 1.6+, Opera 7+, Netscape 6+, Safari 1.2

getElementsBySelector

Olivier Gambier
IE/Win 6+, Firefox 1.5+, Opera 8.5+, Safari 1.2+

$$

Sam Stephenson (Prototype JavaScript framework 1.0.5rc2)
IE/Win 6+, Firefox 1.0+, Mozilla 1.7+, Safari 1.2+

getElementsBySelector

Simon Willison
IE/Win 6+, Firefox 1.5+, Mozilla 1.3+ *

$

John Resig (jQuery)
IE/Win 6+, Firefox 1.5+, Opera ?, Safari ? *

getElementsBySelector

Joe Hewitt
This function requires XPath support.
Firefox 1.0+, Mozilla ?, Opera ? *

getElementsByAttribute

getElementsByAttribute

Robert Nyman
IE/Win 6+, Firefox 1.5+ *

getElementsByAttribute

David “liorean” Andersson
IE/Win 5+, Firefox 1.0+ *

getElementsByAttribute

Jack Sleight
This function was written to be used with the Prototype JavaScript framework.
IE/Win 6+, Firefox 1.5+ *

getElementsByAnything

$

Matthew Pennell
This function will look for a matching id, then class name and finally a tag name, it can also take multiple arguments.
IE/Win 6+, Firefox 1.0+