Can I add an event listener to execute a code every time a new letter is typed in an input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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.

24th Nov 2020, 9:01 PM
Karak10
Karak10 - avatar
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
24th Nov 2020, 9:17 PM
Kevin ★
+ 1
I think you could use keypress for that.
24th Nov 2020, 10:05 PM
Bryan Moreno
Bryan Moreno - avatar
0
There is a very easy way to do that with Vue.js 😃 https://code.sololearn.com/W11JiwNB4YWz/?ref=app
24th Nov 2020, 11:46 PM
Atoms~⚛
Atoms~⚛ - avatar