Easy Tutorial
❮ Met Dialog Showmodal Jsref Getutcmilliseconds ❯

Script text Attribute

Script Object

Example

Retrieve the content of a <script> element:

x Output result:


Definition and Usage

The text attribute sets or returns the content of a <script> element.


Browser Support

All major browsers support the text attribute.


Syntax

Return the text attribute:

Set the text attribute:

Attribute Values

Value Description
contents Specifies the content of the script.

Technical Details

| Return Value: | A string representing the content of the script. Returns the content of all child text nodes of the <script> element (other nodes, such as comments or elements, are ignored). | | --- | --- |


More Examples

Example

Another example - Retrieve the content of a <script> element:

x Output result:

Script Object

❮ Met Dialog Showmodal Jsref Getutcmilliseconds ❯