Script text attribute
Definition and usage
text
Attribute settings or return <script> element Content.
See also:
HTML Reference Manual:HTML <script> Tag
Example
Example 1
Get the content of the <script> element:
var x = document.getElementById("myScript").text
Example 2
Another example of how to get the content of a <script> element:
var x = document.getElementById("myScript").text
Syntax
Return the text attribute:
scriptObject.text
Set text attribute:
scriptObject.text = contents
Attribute Value
Value | Description |
---|---|
contents | Specifies the content of the script. |
Technical Details
Return value: |
A string value representing the content of the script. Returns all text nodes that are children of the <script> element in tree order (other nodes, such as comments or elements, will be ignored). |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |