0
why won't onchange work here?
the div doesnt update onchange https://code.sololearn.com/WMZ87zckU5pQ/?ref=app
3 Réponses
+ 3
let hm = document.getElementById("hm");
script = () => {
hm.innerHTML = "Hello";
}
// Good Luck
+ 1
https://www.w3schools.com/jsref/event_onchange.asp
https://www.w3schools.com/jsref/event_onkeydown.asp
It work but not as you expect, onchange will change when you press enter for input.
Onchange are mostly used for select, radio or chackbox.
You can replace it with oninput, or if you need to change on every key, use onkeyup or onkeydown event insted
+ 1
PanicS used onkeyup and it works 👍