+ 6
HTML AND JAVASCRIPT
how can i get the input from html form (input is number) then store in a variable in javascript so that i manipulate those number through javascript????????
3 Respuestas
+ 5
You can assign the value of the input field of the form to a variable in the script, e.g.
let a = document.getElementById (
'inputFieldId'
).value;
You get, however, a string from that, so you would have to parse it to a number by using parseInt() or parseFloat() before using it.
Reference:
https://www.w3schools.com/jsref/prop_text_value.asp
+ 1
Many learn