michael wrote:
I guess this is partly a javascript questions, but is there a way to check
if a CSS id or class exists anywhere on a page.
For example, if the id "bla" exists, it should return true only if the
following tag is on the page:
<a href="bla.html" id="bla">
In the above code, id is an HTML attribute name and "bla" is an HTML
attribute value.
"getElementById introduced in DOM Level 2
Returns the Element whose ID is given by elementId. If no such
element exists, returns null."
http://www.w3.org/TR/2000/REC-DOM-Le...ml#ID-getElBId
So,
if(document.getElementById("bla"))
{
... [instructions if it exists];
}
else
{
... [instructions if it does not exist];
};
DU