The function that is required to be executed is assigned as the handler function to this property. There are a few different ways to load a script on your page. HTML. 1. The load event on the window object triggers when the whole page is loaded including styles, images and other resources. May you live in peace! Here you will learn two ways to call javascript function after the whole web page is loaded. Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute. Does WP have a specific way to do this. JavaScript. How to call a JavaScript function on a click event? Call JavaScript Function on Page Load