Baseline Widely available *
The text
property of the HTMLScriptElement
interface is a string that reflects the text content inside the <script>
element. It acts the same way as the Node.textContent
property.
It reflects the text
attribute of the <script>
element.
A string.
Examples<script id="el" type="text/javascript">
const num = 10;
console.log(num);
</script>
const el = document.getElementById("el");
console.log(el.text); // Output: "\n const num = 10;\n console.log(num);\n"
console.log(el.textContent); // Output: "\n const num = 10;\n console.log(num);\n"
el.text = "console.log(10);";
console.log(el.text); // Output: "console.log(10);"
console.log(el.textContent); // Output: "console.log(10);"
Specifications Browser compatibility
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