Hi im getting the error "Uncaught TypeError: Cannot set property 'onclick' of null" ive tried
- wrapping "window.onload" around my code
- moving the script link in html at the top and bottom of the page
I haven't found any other solutions online,
Here is my HTML
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,700,600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
</head>
<body>
<div class="Contact">
Contact
<a class="a3">
<i class="fa fa-chevron-up"></i>
</a>
</div>
<script src = "Script.js"></script>
</body>
</html>
Here is my JS
var arrowThree = document.getElementById("a3");
arrowThree.onclick = function(){
alert("You clicked on Contact");
};
Of course there is more to my JS and also a css file but its not important to the question