So I've been at this for hours and I've been trying to do some homework in web development. I ended up quitting the original document since it is very large and distracting and just creating a barebones document trying to figure out why my form variable is null. The code I ended up writing is below:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<script src="index.js"></script>
</head>
<body>
<form id="mainForm">
<fieldset>
<legend>Form legend</legend>
<input type="submit" />
</fieldset>
</form>
</body>
</html>
JavaScript
var form = document.getElementById("mainForm");
So, can someone clear up why the form variable is coming back as null?