JavaScript document scripts Property Tutorial

In this section, we will learn what the document scripts property is and how to use it in JavaScript.

What is document scripts Property in JavaScript?

The JavaScript document scripts property returns a collection of the entire <script> elements in an HTML document.

document scripts Property Syntax:

document.scripts;

document scripts Property Input Value

The property is read-only and so we can’t assign a new value to it.

document scripts Property Return Value

The return value of this property is a collection that has the entire <script> elements of an HTML document.

Example: using document scripts Property in JavaScript

See the Pen using document scripts Property in JavaScript by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies