Why onchange dom évent does not fire ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why onchange dom évent does not fire ?

I tried in this <input type="text" value="" onchange="alert('fired event !') /> in the PlayGround and when i run the code, the onchange event does not fire, can anyone tell me the reason ?

17th Jul 2018, 9:28 AM
Youssouf Mbaé Ahamada Saidou
Youssouf Mbaé Ahamada Saidou - avatar
5 Answers
+ 1
onchange its fired when you change the value and your element lose the focus (try to click outside the element after change his value). For get immediate result, use "oninput" P.S. Dont forget to add " for close onchange value because in your posted code its missing
17th Jul 2018, 9:57 AM
KrOW
KrOW - avatar
+ 1
Ok i try oninput
17th Jul 2018, 10:04 AM
Youssouf Mbaé Ahamada Saidou
Youssouf Mbaé Ahamada Saidou - avatar
+ 1
Thanks, oninput works well
17th Jul 2018, 10:07 AM
Youssouf Mbaé Ahamada Saidou
Youssouf Mbaé Ahamada Saidou - avatar
0
Please insert your code here,so we can check it out.
17th Jul 2018, 9:55 AM
Jonas Schröter
Jonas Schröter - avatar
0
👍👍👍
17th Jul 2018, 10:08 AM
KrOW
KrOW - avatar