I am trying to active .click on something and it's just not working.
example HTML :
<input type="text" id="food">
js :
$('#food').click( () => {
console.log('working');
})
I tried to use addeventlister without jquery and I am getting this:
Uncaught TypeError: Cannot read property 'addEventListener' of null at script.js:11
code :
const foodEL = document.getElementById('food');
foodEL.addEventListener( 'click', () => {
console.log('working');
})