How to input and give value to var | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

How to input and give value to var

if input 3 x =3 js

22nd Jul 2018, 7:19 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
13 Answers
+ 2
https://code.sololearn.com/WSiN89dyeniq/#js Read this code carefully. If you have any questions, feel free to ask.
24th Jul 2018, 3:43 AM
Daniel Cooper
Daniel Cooper - avatar
+ 6
Daniel Cooper can you show me !!
23rd Jul 2018, 2:09 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 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;
22nd Jul 2018, 11:11 PM
Daniel Cooper
Daniel Cooper - avatar
22nd Jul 2018, 11:03 PM
Daniel Cooper
Daniel Cooper - avatar
+ 2
Kaimi I agree with you.. var x= prompt(message)// for reading.. alert(x)// for writing..
22nd Jul 2018, 9:58 PM
ADIL GAAFER
ADIL GAAFER - avatar
+ 1
for me document.getElementById("test").value; not vorking
4th Aug 2018, 10:08 AM
Jonas
+ 1
Jonas can you show me the steps you took?
4th Aug 2018, 2:41 PM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Thanks
5th Aug 2018, 9:00 AM
Jonas
+ 1
Not now
5th Aug 2018, 9:01 AM
Jonas
0
Jonas Post your code please. I can figure out why it's not working.
5th Aug 2018, 6:43 AM
Daniel Cooper
Daniel Cooper - avatar
5th Aug 2018, 8:38 AM
Jonas
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.
5th Aug 2018, 8:58 AM
Daniel Cooper
Daniel Cooper - avatar
0
Jonas Np. Anything else you need help with?
5th Aug 2018, 9:00 AM
Daniel Cooper
Daniel Cooper - avatar