Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
Why doesnāt var x = input.value work sometimes?
Iāve tried using var x = document.getElementById(āinputā).value; before and it didnāt really work. I never used it since then. I just used input.value instead of var x = input.value; Iāve tried using the the var x... method today, it didnāt work as expected. I donāt really have a specific code right now, but y doesnāt it work?
1 Resposta
0
Try to console.log(input)
See to it that it is a valid DOM element you can use, e.g. it is not undefined, and you don't get an error message in console.
Run the test in window.onload event handler to ensure the element is rendered beforehand.