I have created a live search, I want when user clicks on ESC it should focus to input box and remove its content if not empty automatically.
I am able to remove the cont
You can't call clear function on input.
clear
input
You have 2 options:
Clear the specific input using input.value = '';
input.value = '';
Like this:
Or you can use the method reset() but you can call it only on form element. The good point in this solution is if you want to clear many inputs.
reset()
form