The DOM element inputName has a value of null when reading the .js file, but is working as it is supposed to when I type the same code into the console.
console.log("working");
var inputName = document.getElementById("name");
console.log(inputName);
<div class="col-2">Event Name:</div>
<div class="col-10"><input type="text" id="name"></div>
When I type inputName into the console it has a value of null. When I type "var inputName = document.getElementById("name");" into the console it then has the correct value of <input id="name" type="text">
.