I can only assign events inline in html. The external script is being read as the functions housed in the script file are being executed.
I have tried assigning with the following methods:
$('link-1').on('mouseover', boldLink("link-1"))
document.getElementById('link-1').onmouseover(boldLink("link-1")
document.getElementById('link-1').addEventListener('mouseover', boldLink('link-1'))
I have tried housing the event listeners in a window.onload()
function as well. Sometimes it will fire once (even when the mouse has not been over the element), but otherwise it doesn't work.
I have tried moving my <script type="text/javascript" src="/script.js"></script>
to the end of the body. Currently it's in the header causing the same problems.
This is happening with all event types as well, not just the mouseover
event.