uCertify CIW – Advanced HTML5 & CSS3 Specialist Practice Test

Session length

1 / 20

Which JavaScript event fires when a page finishes loading in the browser?

click

load

When the page is fully ready in the browser, the load event fires. This signal means everything in the document has finished loading, including all resources like images, stylesheets, and scripts. You typically attach a listener to the window for this event, for example: window.addEventListener('load', function() { /* code here runs after everything loads */ });

This makes it the best choice for code that depends on all assets being available. In contrast, other events serve different purposes: a click event responds to user clicks on elements, not page loading; a submit event happens when a form is submitted; and an unload event triggers when the user navigates away from the page, not when the page initially finishes loading. If you only need to run code once the HTML is parsed but before images are loaded, you’d use the DOMContentLoaded event instead.

submit

unload

Next Question
Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy