Properties and methods of HTML tag objects
Every HTML tag is represented by a JavaScript object. Tags are organized in a tree hierarchy, where tag x
is a parent of tag y
, if y
falls completely within x
's opening and closing tags (<x>x content <y>y content</y> more x content.</x>
). For this reason, your code should be well-formed.
The following table lists the properties and methods of tag objects in Adobe Dreamweaver, along with their return values or explanations. A bullet () marks read-only properties.
Property or method | Return value |
---|---|
nodeType | Node.ELEMENT_NODE |
parentNode | The parent tag. If this is the |
childNodes | A |
tagName | The HTML name for the tag, such as |
attrName | A string that contains the value of the specified tag attribute. |
innerHTML | The source code that is contained between the opening tag and the closing tag.For example, in the code |
outerHTML | The source code for this tag, including the tag. For the previous example code, |
getAttribute(attrName) | The value of the specified attribute if it is explicitly specified; |
getTranslatedAttribute(attrName) | The translated value of the specified attribute or the same value that |
setAttribute(attrName, attrValue) | Does not return a value. Sets the specified attribute to the specified value: for example, |
removeAttribute(attrName) | Does not return a value. Removes the specified attribute and its value from the HTML for this tag. |
getElementsByTagName(tagName) | A If the If the |
hasChildNodes() | A Boolean value that indicates whether the tag has any children. |
hasTranslatedAttributes() | A Boolean value that indicates whether the tag has any translated attributes. (This property is not included in DOM Level 1; it was added to Adobe Dreamweaver 3 to support attribute translation.) |