Fill in the blank:Addthe________attribute to your script to tell the browser to execute it after construction of the DOM.
Choose an answer
Tap an option to check your answer.
Correct answer: defer.
Why this is the answer
The correct answer is defer.When you include the defer attribute in your script tag,it instructs the browser to download the script while parsing the HTML document but to execute it only after the HTML document has been fully parsed and theDOM(Document Object Model)has been constructed.This means that the script will be executed in the order it appears in the document,after all the elements in the HTML have been loaded and before the event is fired.This attribute is DOM Content Loaded particularly useful when you have scripts that rely on the DOM being fully loaded before they execute,ensuring that they don't interfere with the rendering of the page or cause errors by trying to access elements that haven't been created yet.It helps improve page loading performance by allowing the browser to download scripts asynchronously while still preserving their order of execution,which can lead to a better user experience.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed