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
Syntaxvar 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.
ExamplesThe 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.
NotesMicrosoft Developer Network: [Windows Internet Explorer API reference Article]
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