The `DOMContentLoaded` event listener waits for the [[DOM]] to load before running. This is critical for any code that interacts with elements on your page. If your code runs before the elements exist, you might get errors and at the very least your code won't behave as expected. ```javascript document.addEventListener('DOMContentLoaded', function () { // add code here }); ``` An alternative to `DOMContentLoaded` is `window.onload()`. My typical pattern is to include an `initializeApp()` function that runs with the successful execution of any server side code. On [[base/Google Apps Script/Google Apps Script]], that would look like this where `initializeApp()` is a function in your JavaScript file and `getData()` is a function in the `Code.gs` file. ```javascript document.addEventListener('DOMContentLoaded', function () { google.script.run.withSuccessHandler(initializeApp).getData(); }) ```