web api constructor
Text: Text() constructor
The Text() constructor returns a new Text object
with the optional string given in parameter as its textual content.
Syntax
new Text()
new Text(string)
Parameters
stringOptional- : A string representing the textual content of the text node.
Return value
A new Text object with the content of the string parameter, or the empty string if no parameter was given.
Example
let text = new Text("Test");
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- The DOM API