can anyone tell why I am receiving this error?
Uncaught TypeError: Cannot read property 'addEventListener' of null
I am trying to enter a value into a form, click submit, and print the value on the console.
Thanks :)
var form = document.querySelector('form.doing');
var input = form.addEventListener('submit', function(){
console.log(input.value);
});
This is a list app.
<form class="doing" method="post">
<input type="text" id="name" name="user_name"
placeholder="What needs doing?">
<button type="submit">Enter</button>