0

why won't onchange work here?

the div doesnt update onchange https://code.sololearn.com/WMZ87zckU5pQ/?ref=app

6th Dec 2021, 10:02 PM
Sheldon 10110
Sheldon 10110 - avatar
3 Respuestas
+ 3
let hm = document.getElementById("hm"); script = () => { hm.innerHTML = "Hello"; } // Good Luck
7th Dec 2021, 12:49 AM
SoloProg
SoloProg - avatar
+ 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
6th Dec 2021, 10:15 PM
PanicS
PanicS - avatar
+ 1
PanicS used onkeyup and it works 👍
9th Dec 2021, 11:48 AM
Sheldon 10110
Sheldon 10110 - avatar