+ 1

how to make a function so that it can read the contents of the input?

11th Oct 2020, 3:45 AM
Yusuf Rabbani
Yusuf Rabbani - avatar
2 odpowiedzi
+ 4
you can read the value of input by first selecting that which input do you wanna read the value of, let myInput = document.getElementById("myInput") console.log(myInput.value) // its value You can add a keyup event listener to that input so that you can get the value of input on every keystroke, myInput.addEventListener("keyup", (e) => { }) in this function you automatically get (e) which is the event, and the target of this event is myInput, so e.target would be the same as myInput, and you can get the value from both, myInput.value and e.target.value
11th Oct 2020, 5:34 AM
maf
maf - avatar
+ 1
Thanks
11th Oct 2020, 7:23 AM
Yusuf Rabbani
Yusuf Rabbani - avatar