New course! Every coder should learn Generative AI!
Try a free lesson0
Can I add an event listener to execute a code every time a new letter is typed in an input?
I want to make it so immediately after the letter is typed the code is run, without needing to press enter, if that's not possible is there any way to at least make it so the code runs after the user leaves the input, something like the unfocus pseudo class of CSS for example.
3 Answers
+ 7
onchange event will be fired when pressing enter
oninput event will be fired when typing/erasing
onblur event will be fired when the input loses focus
You might be looking for some of them
+ 1
I think you could use keypress for that.
0
There is a very easy way to do that with Vue.js 😃
https://code.sololearn.com/W11JiwNB4YWz/?ref=app