Snippets

Execute jQuery code after a page load

Posted by I. B. Gd Pramana A. Putra, 09 Aug 22, last updated 09 Aug 22

This code example below will show you how to execute a jQuery code only after a page is completely loaded. The benefit of this is to make sure a page already loaded before a jQuery code get executed.

$(window).on("load", function() {
    customFunction();
});

The point is to use on("load") with jQuery to execute a code after a page is completely loaded.

I love sharing code snippets as most of the time, a quick code example is what we're looking for instead of long-written articles. If you think my code snippets are helpful and save you a lot of time, please consider buying me a cup of coffee :)

Support me via · paypal · buymeacoffee · ko-fi · trakteer
Contributed Snippets
Answer & Responses
    No comments yet

Wanna write a response?

You have to login before write a comment to this post.