[Solved] I am new to programming and I cannot figure out why my external js file wont work [closed]


It is proper practice to define script tags in the <head> or <footer> tag. Also when linking to your Javascript file the methods in the file won’t be called automatically unless you use document.ready.

If you wish for a function to be called as soon as the page loads use document.ready or create a script tag in the <head> or <footer> and call the function from there:

<script type="text/javascript">
    myfunction();
</script>

Also in the JS file code shouldn’t just be laying about, they should be organized/enclosed in functions.

solved I am new to programming and I cannot figure out why my external js file wont work [closed]