HTML DOM Element outerText attribute
- Daukar zuwa ɗaya na baya outerHTML
- Daukar zuwa ɗaya na kusa ownerDocument
- Daukar zuwa ɗaya na baya HTML DOM Elements ɗanin
Definition and usage
outerText
attribute sets or returns the text content of the specified node.
This attribute is similar to the internal innerText attribute, in fact, get outerText
and get innerText
attribute returns the same result.
Set the element's outerText
There is an important difference at this time: the element itself will be 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 | Text content of the node and all its descendants. |
Browser support
Table numbers indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
43 | 11 | Ba a ɗaukar ba | 6 | 61 |
- Daukar zuwa ɗaya na baya outerHTML
- Daukar zuwa ɗaya na kusa ownerDocument
- Daukar zuwa ɗaya na baya HTML DOM Elements ɗanin