How to get Html user input form and use it in javascript code / set it as a variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get Html user input form and use it in javascript code / set it as a variable

please when you get it is it going to be a number or string please help You can help with this code https://code.sololearn.com/Wu1WWPd10G9a/?ref=app

22nd Oct 2020, 10:43 AM
Tim Don👨🏾‍💻🤟
Tim Don👨🏾‍💻🤟 - avatar
5 Answers
+ 2
Here's ur answer, hope u like it : https://code.sololearn.com/W3M24FNZ9ybk/?ref=app
26th Oct 2020, 4:29 PM
Tekashi69{Oliseh}
Tekashi69{Oliseh} - avatar
+ 1
Use this: <input type="number" id="inp" > Var userInput=document.getElementById("inp").value also in line 9 of html use spaces between tag name and attribute
22nd Oct 2020, 10:47 AM
Sadness
Sadness - avatar
+ 1
Thanks so much ones again
26th Oct 2020, 5:14 PM
Tim Don👨🏾‍💻🤟
Tim Don👨🏾‍💻🤟 - avatar
22nd Oct 2020, 12:07 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
you need to add a submit button, and then add an event listener to extract the value of input when you submit.
23rd Oct 2020, 10:17 AM
Logomonic Learning
Logomonic Learning - avatar