My index.html file:
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8" />
<title> My Title </title>
<link rel = "stylesheet" href = "main.css">
</head>
<body>
<script type = "text/javascript" src= "myScript.js"> </script>
<script>
myFunction();
</script>
</body>
</html>
myScript.js file:
<!--
function myFunction(){
alert("external file worked");
}
// -->
When I run this - no alert pops up. But if I change myScript.js to this:
<!--
alert("external file worked");
// -->
It alerts just fine. So my problem is in the function call, but I cannot see anything wrong with it. Anyone with sharper eyes than me can help?