I added the following script to my html body:
<script type="text/javascript">
function customizeNavbar() {
var d = document.getElementById("navwrap");
d.classList.add("container");
var e = document.getElementById("navhead");
e.classList.add("container");
}
</script>
<script onload="customizeNavbar();"></script>
It's not running my function on load.
Clicking some element <div onclick="customizeNavbar();" />
behaves as expected.
What can I do to get this page to run my script on load?
Context
This is found in the body element. It's changing the navbar of a master layout to avoid having to update the master layout. The navbar comes before this script is reached.
Not sure why this is getting down-voted. Yet to have anyone provide a good explanation or a solution that actually works.