Best practice for using window.onload
I develop Joomla websites/components/modules and plugins and every so often I require the ability to use JavaScript that triggers an event when the page is loaded. Most of the time this is done using the window.onload
function.
My question is:
- Is this the best way to trigger JavaScript events on the page loading or is there a better/newer way?
- If this is the only way to trigger an event on the page loading, what is the best way to make sure that multiple events can be run by different scripts?