text property (script, title, CommentNode, ...)
Sets or returns a string that corresponds the contents of the element.
The text property for CommentNode elements is only supported by Internet Explorer. If you need the text content of a CommentNode or TextNode, use the data or nodeValue property.
You can find the related objects in the Supported by objects section below.
This property is read/write.
String that sets or retrieves the text content of the object.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the text property:
Did you find this example helpful?
User Contributed Comments