Getting TAG names with javascript

b4u

Golden Member
Nov 8, 2002
1,380
2
81
Hi,

Need some help on this one ...

Let's imagin the following html elements:

<span id="elem1">Some Text</span>
<img id="elem2" src="none.gif" title="Tooltip">
<input id="elem3" name="cmdOK" type="button" value="OK" onclick="some_function();">


Now I have a for loop in javascript that allows me to get the elements by their id. So I run through elem1, elem2, elem3, ...

What I want to know, is how to get the tag names of each element?

Example:

alert( objElem.type ) will show me a message box with "button", but will show nothing on span and img elements, because they have no type property.

What I would like to get, is the tag name, like "span", "img", "input", ...

Is there a property that gives me that? Can't seem to find any ... and can't seem to find any code that can list all properties in a specific object, like an "img" for instance.


Thanks
 

b4u

Golden Member
Nov 8, 2002
1,380
2
81
MrChad

Exactly what I was looking for ... time to get more detailed info about DOM manipulation.

Thanks ;)