DEV Community

Robert Look
Robert Look

Posted on

Call JavaScript Function After Page Load Complete

First Simple Way

You also know that in HTML tag holds the actual content that is used to display to the users. Using the onload javascript with HTML tag, you can call javascript function after page load complete. The onload javascript event whenever the element has finished loading and jquery call function after load HTML.

Call JavaScript Function After Page Load Complete

<!DOCTYPE html> 
<html> 

<head> 
    <title>Call JavaScript Function After Page Load Complete - phpcodingstuff.com</title> 
</head> 

<body onload="afterPageLoad()"> 

    <h1>Welcome to phpcodingstuff.com</h1> 

    <p>call javascript function before page load complete</p> 
</body> 

<script language='javascript'>
function afterPageLoad(){
   alert('Hello World');
}
</script>

</html>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)