I have a function, foo, that I would like to add to window.onload however my problem is that there is already another function, bar, set to window.onload. How can I get both functions attached. I have no access to change the logic of how bar is added to window.onload therefore I can’t use the paradigm addEvent(…) . Would something like the following work in all cases?
<script>
$(window).load(foo(){
//my code here
});
</script>
//lots of html
//potentially this happens before or after my above script
<script>
window.onload = bar();
otherFunction(){
//other function code here
};
</script>