Avada › Forums › Community Forum › Can't fire script – body onload() automatically parses out in html code
-
AuthorPosts
-
I need to fire a script – I put <body onload=”loaded()”> at the top of my page but Avada strips it out. How do I fire the script? Using
didn’t work. Nor did either of the two scripts below. Any ideas?
<script type=”text/javascript”>
window.onload = loaded() {
init();
}</script><script type=”text/javascript”>
window.onload = loaded;
</script>Where are you attempting to add your JS? For scripts, you can add them to Theme Options > Advanced – Code Fields. There is no reason to edit the HTML, the body onLoad is a standard event. You can also use jQuery for that since it is already loaded.
For example – http://learn.jquery.com/using-jquery-core/document-ready/
Documentation – https://api.jquery.com/load-event/ and https://api.jquery.com/ready/ -
AuthorPosts
- You must be logged in to reply to this topic.