HTML DOM Element outerText attribute
- Προηγούμενη Σελίδα outerHTML
- Επόμενη Σελίδα ownerDocument
- Επιστροφή στο Πρόγραμμα Σώμα Elements του HTML DOM
Definition and usage
outerText
attribute sets or returns the text content of the specified node.
This attribute is similar to the internal innerText attributein fact, get outerText
and get innerText
attribute returns the same result.
Set the outerText
There is an important difference when an element is removed.
Tip:See also outerHTML attribute.
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 (replace 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 | The text content of the node and all its descendants. |
Browser support
The numbers in the table indicate the version of the browser that first fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
43 | 11 | Μη Υποστηριζόμενο | 6 | 61 |
- Προηγούμενη Σελίδα outerHTML
- Επόμενη Σελίδα ownerDocument
- Επιστροφή στο Πρόγραμμα Σώμα Elements του HTML DOM