+ 10
How to input and give value to var
if input 3 x =3 js
14 Answers
+ 2
https://code.sololearn.com/WSiN89dyeniq/#js
Read this code carefully. If you have any questions, feel free to ask.
+ 6
Daniel Cooper can you show me !!
+ 4
in short, I set the value of the input box as the variable.
So if we have an element with the ID "test", it would look like this:
var VariableName = document.getElementById("test").value;
+ 2
Kaimi
I agree with you..
var x= prompt(message)// for reading..
alert(x)// for writing..
+ 1
for me document.getElementById("test").value; not vorking
+ 1
Jonas can you show me the steps you took?
+ 1
Thanks
+ 1
Not now
0
Jonas Post your code please. I can figure out why it's not working.
0
I have a Q&A ongly for the bug
https://www.sololearn.com/discuss/1438156/?ref=app
0
Jonas
https://code.sololearn.com/WFTa2TlBQ3wZ/?ref=app
Fixed it
1. You set the variable to the value of the PARENT element. Set the variable to the value of the text input. It's id is "input".
2. The variables should be declared INSIDE the function.
0
Jonas Np. Anything else you need help with?