When i try to fire a event listener in js for an input element it is not getting called. This is how I am trying to do it.
var el = document.getElementById(“inputEl”);
el. addEventListener('focus', (event) => {
console.log(‘inside this block’);
});
What am I doing wrong here?
Change your js as below:
var el = document.getElementById("inputEl");
el.addEventListener('focus', (event) => {
console.log('inside this block');
});
And also place your .js file at the bottom in your index.html