I can't figure out why .value isn't working. I've also tried .querySelector instead of .getElementById, but I keep getting undefined in the console.
var submit = document.querySelector('#submit');
var name = document.getElementById('ship-name');
submit.onclick = function() {
console.log(name.value);
};
<div class="box">
<h2>Where do you want your stuff sent?</h2>
<label for="ship-name">
<input class="full text-input" id="ship-name" type="text" placeholder="Name" required>
</label>
<label for="ship-add-1">
<input class="full text-input" id="ship-add-1" type="text" placeholder="Address Line 1" required>
</label>
<label for="ship-add-2">
<input class="full text-input" id="ship-add-2" type="text" placeholder="Address Line 2" required>
</label>
<label for="ship-add-3">
<input class="full text-input" id="ship-add-3" type="text" placeholder="Address Line 3" required>
</label>
<label for="ship-4">
<input class="full text-input" id="ship-add-4" type="text" placeholder="Address Line 4" required>
</label>
</div>
submit?namein the global scope. This will be a reference towindow.namewhich will always be a string.submitdoes not exist in the snippet. But even if it is added,namewill be a string and not an element, and a string doesn't have avalueproperty. Just rename the variableshipNameor something else, and the problem will go away.