|
|
Faster way of accessing DOM elements with same ID
|
04/10/2006, By Pavan Keely
|
I recently came across an article posted by Alex Russell (Project lead of DOJO) and he talks abt using same Id for multiple elements and a faster way of accessing those elements using one of his methods. I have to agree with him that using same Ids for multiple elements is very much useful sometimes and I've been using that technique for quite sometime now. But there is an easy way to access those DOM elements faster than whatever Alex specifies. Let's get into an example and see how that can be achieved.
This technique uses, document.all for getting the elements with the same ID. I know it's not a standard to use document.all and same ID for multiple elements. But this article shows you that there is a way and I am not encouraging you to use same ID for multiple elements. Now, most of the browsers implemented document.all, making it easier to use and no there's no cross-browser play you have to do in your code.
Read More...
|
|
|
|
|
|
|
|
|
|
|
|