C
Clive Backham
My use of Javascript has until now been fairly limited, but I am now
starting to look into using it to manipulate the DOM. To this end it
appears that getElementById is a core function.
However, I have been in the habit of setting CSS styles through the
use of ID attributes, which means that many of my pages have multiple
elements with the same ID, and of course this makes using
getElementById rather difficult.
It strikes me that perhaps using the ID attribute to select a style is
deprecated, and I should switch to using the CLASS attribute instead.
Would I be correct in thinking this, or is there some other more
subtle issue that I have missed?
starting to look into using it to manipulate the DOM. To this end it
appears that getElementById is a core function.
However, I have been in the habit of setting CSS styles through the
use of ID attributes, which means that many of my pages have multiple
elements with the same ID, and of course this makes using
getElementById rather difficult.
It strikes me that perhaps using the ID attribute to select a style is
deprecated, and I should switch to using the CLASS attribute instead.
Would I be correct in thinking this, or is there some other more
subtle issue that I have missed?