A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/HTMLScriptElement/text below:

text ยท WebPlatform Docs

text Summary

Legacy. Use textContent instead. When setting, does same as textContent. When getting, gets a concatenated version of all of the child text nodes of a script element.

Property of dom/HTMLScriptElementdom/HTMLScriptElement

Syntax
var scriptCode = scriptElement.text;
scriptElement.text = newScriptCode;
Return Value

Returns an object of type StringString

A concatenation of all of the child text nodes of the element.

Examples

The following script gets the code of an inline script element, changes the name of a function, constructs a new scripts element, sets the changed code as its code and appends it to the document in order to run it.


var script = document.getElementById("some-script");



var scriptCode = script.text;



scriptCode = scriptCode.replace("function someFunction()", "function newFunction()");


var newScript = document.createElement("script");



newScript.text = scriptCode;



document.head.appendChild(newScript);
Usage
 Legacy. Use textContent instead.

Use this property to get a concatenated version of all of the child text nodes of a script element. Setting this property works the same way as setting the textContent property.

Notes Related specifications
Document Object Model (DOM) Level 1
W3C Recommendation
WHATWG HTML
Living Standard
HTML5
W3C Last Call Working Draft
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4