we use <body onload="f1()"> for doing something onload
Is there anyway i can run a script f1 function after a page is loaded fully ??
Please answer with an example (jsfiddle preferred)
we use <body onload="f1()"> for doing something onload
Is there anyway i can run a script f1 function after a page is loaded fully ??
Please answer with an example (jsfiddle preferred)
The $(window).load(function() { event executes a bit later when the complete page is fully loaded, including all frames, objects and images
Using jQuery
<script>
$(window).load(function() {
alert( "window loaded" );
f1(); // Your function call
});
</script>
Using Pure JS
<script>
window.onload = function() {
alert( "window loaded" );
f1(); // Your function call
};
</script>
<script>
f1();
</script>
add this script before closing body tag i.e
</body>