+ 1

My browser is not display. I want to do input change évent with updateValue. Thanks you sir.

input event listener updateValue. https://code.sololearn.com/WNG6iE4O39uj/?ref=app

31st Jul 2021, 1:18 PM
Malick Diagne
Malick Diagne - avatar
3 ответов
+ 2
// There are a few problems. I strongly recommend to repeat JavaScript tutorial and learn the kanguage basics from more sources. input.addEventListener ("input",function (e) { const input = document.querySelector ("input"); const log = document.getElementById ("log"); log.innerText = e.target.value; });
31st Jul 2021, 1:38 PM
JaScript
JaScript - avatar
+ 2
Your code is not in readable form, try to make it readable.
31st Jul 2021, 2:17 PM
Coder-Rohit[{(∞)}]
Coder-Rohit[{(∞)}] - avatar
+ 1
window.onload = () =>{ //begin structure var input = document.createElement ("input"); input.placeholder = "Enter some text"; document.body.appendChild(input) //p var p = document.createElement ("p"); //set id p.setAttribute ("id","log"); //document document.body.appendChild(p); //end structure input.oninput = updateValue; //document document.body.appendChild (input ); //event input.addEventListener("change", updateValue) function updateValue(e) { const input = document.querySelector("input"); const log = document.getElementById ("log"); log.innerText = input.value;}; }
31st Jul 2021, 1:34 PM
Coder-Rohit[{(∞)}]
Coder-Rohit[{(∞)}] - avatar