Quantcast
Viewing all articles
Browse latest Browse all 42

Answer by Chris for Is there += for window.onload in Javascript?

In jquery you can do

$(document).onload(function() {  // do something}

//then later on do

$(document).onload(function() {  // do something here too!}

jQuery will intelligently add both events to the onload event and both will be executed when the page loads. With jQuery you also get crossbrowser support as an added bonus.


Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>