I have a script in my phtml file but I want to only load this ones the page is fully loaded. I am doing a check if my custom module is enabled show the < script >
Adding script like this :
You can achieve this using template call
<referenceContainer name="before.body.end">
<block class="Magento\Framework\View\Element\Template" template="Namespace_Modulename::before.phtml" name="before_body_js"/>
</referenceContainer>
Can anyone give me a advice or help to figure this out
<script>
document.getElementById("demo").innerHTML = "My First JavaScript";
</script>
I have to use this as well
<script type="text/javascript">
alert("This alert box was called with the onload event");
</script>