HTML DOM Element outerText property
- Forrige side outerHTML
- Næste side ownerDocument
- Gå tilbage til forrige niveau HTML DOM Elements objekt
Definition and usage
outerText
property sets or returns the text content of the specified node.
This property is similar to the internal innerText property, actually getting outerText
and get innerText
property returns the same result.
Set the element's outerText
There is an important difference when it is removed: the element itself will be removed.
Tip:See also outerHTML property.
Example
Set the external text of the element:
document.getElementById("myH1").outerText = "Changed content!";
Syntax
Return the text content of the node:
node.outerText
Set the text content of the node (replaces the entire node):
node.outerText = text
Attribute value
Value | Type | Description |
---|---|---|
text | String | Specify the text content to be inserted. |
Return value
Type | Description |
---|---|
String | Text content of the node and all its descendants. |
Browser support
Table numbers indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
43 | 11 | Ikke understøttet | 6 | 61 |
- Forrige side outerHTML
- Næste side ownerDocument
- Gå tilbage til forrige niveau HTML DOM Elements objekt