I encountered a length error while executing line 2 in this code snippet.
index.js:10 Uncaught TypeError: Cannot read property 'length' of undefined"
Sample Code:
<div class="formCustomerName">
<label>Name:</label>
<input type="text" id="customerName" placeholder="Name" value=""
required>
</div>
let name = document.getElementById('customerName').value;
form.addEventListener('input', pushData, false);{
if (name.value.length >= 0) {
btn.setAttribute('disabled', 'disabled')
document.getElementById('submitInput').innerHTML = ("Hello If statement here!")
} else {
document.getElementById('submitInput').innerHTML = ("Hello Else statement here!")
btn.removeAttribute('disabled');
}
function pushData() {