Naši dobrovolníci ještě tento článek do jazyka Čeština nepřeložili. Přidejte se a pomozte nám tuto práci dokončit!
Returns the name of the element.
Syntax
elementName = element.tagName;
elementName
is a string containing the name of the current element.
Notes
In XML (and XML-based languages such as XHTML), tagName
preserves case. On HTML elements in DOM trees flagged as HTML documents, tagName
returns the element name in the uppercase form. The value of tagName
is the same as that of nodeName.
Example
HTML content
<span id="born">When I was born...</span>
JavaScript content
var span = document.getElementById("born"); console.log(span.tagName);
In XHTML (or any other XML format), "span"
would be output. In HTML, "SPAN"
would be output instead.
Specifications
Specification | Status | Comment |
---|---|---|
Document Object Model (DOM) Level 3 Core Specification The definition of 'Element.tagName' in that specification. |
Recommendation | No change |
Document Object Model (DOM) Level 2 Core Specification The definition of 'Element.tagName' in that specification. |
Recommendation | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? |
Štítky a přispěvatelé do dokumentace
Štítky:
Přispěvatelé této stránky:
AndySky21,
mrenty,
rolfedh,
VictorCoding,
Sebastianz,
fscholz,
kosvrouvas,
kscarfone,
Sheppy,
ziyunfei,
Jürgen Jeka,
Hsivonen,
Kohei,
Mgjbot,
Ptak82,
Nickolay,
Waldo,
Maian,
Dria,
Callek,
JesseW
Poslední aktualizace od:
AndySky21,