input type search clear event
document.getElementById('searchInput').addEventListener('input', (e) => { console.log(`Input value: "${e.currentTarget.value}"`); })
Here is what the above code is Doing:
1. We’re adding an event listener to the input element with the id of searchInput.
2. The event listener is listening for the input event.
3. When the input event is fired, we’re logging the value of the input element to the console.
The input event is fired every time the value of the input element changes.
Let’s add an event listener to the input element with the id of searchInput.
The event listener should listen for the input event.
When the input event is fired, log the value of the input element to the console.