Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's the best way to get a group of elements?

Status
Not open for further replies.

deadpool42

Programmer
May 24, 2004
40
0
0
I'd like to grab several HTML elements as quickly and easily as possible. document.getElementsByName() would be perfect, but can't be relied upon across browsers. My only idea so far is to use document.getElementsByTagName() and then loop through every tag comparing its id to a regular expression. Please tell me there's a better way.
 
>I believe the .getElementsByID works across browsers.
Faith should be subjected to scrutiny.
[tt]I believe the .getElemen[highlight]tB[/highlight]yI[highlight]d[/highlight] works across browsers.[/tt]
 
Yes, but I want to get every element that's part of a certain group. getElementById() will only return one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top