Question

Which object is commonly used to work with an HTML document where JavaScript code has been embedded?

#javascript

Answer

Most commonly, you work with the document the script is running in by using document in document's scripts. (The same document can also be referred to as window.document.) [1] Ex.

document.getElementById("example-id")

[1] https://developer.mozilla.org/en-US/docs/Web/API/document

Learn

Author

xavi

Reviews
Last
next

Students 0