+ 1
Call function when input is cleared.
I want to call a function when the text input is cleared.
4 Respostas
+ 2
<input type="text">
<script>
var input=document.querySelector("input");
input.oninput=(e)=>{
if(!e.target.value){
console.log("input cleared");
}
};
+ 1
what is (e)
0
showing error when i copy your answer because of "oninput".