How to call a jQuery Function after page (document) load


Friends the following udemy course created by me;

      Click here to attend Spring Framework 4.x and certification course with a discount

Spring Framework and Core Spring Certification Udemy course with discount
Spring Framework and Core Spring Certification Udemy course with a discount coupon

If you want to call a function after the whole html document loaded, you can use the following example;

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>jQueryExample</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
 $(document).ready(function () {
 alert('after page load...');
 $('#afterLoad').html('This Content is updated after page load!');
 });
</script>
</head>
<body>
 <h2>After Page Load Function Call</h2>
 <b>Static Page Content </b><br/>
 <br/>
 <b>Dynamic content;</b><br/>

 <h1><b><span id="afterLoad" style="color:green;"></span></b></h1>
</body>
</html>

Here is the screen shot for this example;
Before loading

After loaded

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s