Why I can't set property onkeyup | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why I can't set property onkeyup

input.onkeyup = function (){ } Why I can't setup property onkeyup....

14th Sep 2020, 4:22 PM
Muhammad Sumon
2 Answers
+ 1
The object has to be selected. For example with: document.getElementById("objIdName").onkeyup = function ...
14th Sep 2020, 4:37 PM
JaScript
JaScript - avatar
0
<body> <form name="problem"> <input name="answer"> </form> <script> document.problem.answer.onkeyup = ()=>{ document.problem.answer.style.background="green"; } </script> </body> Try this type a letter and see effect.
14th Sep 2020, 4:52 PM
Divya Mohan
Divya Mohan - avatar