+ 1

Call function when input is cleared.

I want to call a function when the text input is cleared.

27th Jul 2020, 10:17 AM
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU - avatar
4 Respostas
+ 2
<input type="text"> <script> var input=document.querySelector("input"); input.oninput=(e)=>{ if(!e.target.value){ console.log("input cleared"); } };
27th Jul 2020, 10:31 AM
Abhay
Abhay - avatar
+ 1
what is (e)
27th Jul 2020, 10:37 AM
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU - avatar
0
showing error when i copy your answer because of "oninput".
27th Jul 2020, 11:02 AM
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU - avatar