Get the contents of the <script> element:
The result of x will be:
The text property sets or returns the contents of the <script> element.
The text property is supported in all major browsers.
Return the text property:
Set the text property:
Value | Description |
---|---|
contents | Specifies the contents of the script |
Return Value: | A String, representing the contents of the script. Returns all the text nodes that are children of the <script> element in tree order (other nodes, like comments or elements will be ignored). |
---|
Another example of how to get the contents of the <script> element:
The result of x will be: