jQuery Event How to - Handle window load action event








Question

We would like to know how to handle window load action event.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type='text/javascript'>//<![CDATA[ 
$(function(){<!--from  w  ww .  jav a  2  s. c o m-->
    jQuery(window).load(function($){
       console.log('test here');
    });
});//]]>  
</script>
</head>
<body>
</body>
</html>

The code above is rendered as follows: