+ 2
Variables
So I have an html program with a box in which a user can input items how do I write the JavaScript code to take these items individually and assign them to variables?
3 Answers
+ 1
what input type you are using for getting inputs?
0
Hi,
If you're not intending to use the GET or POST arrays, javascript can read html tags and the text inside (the DOM). Your box is an <input type="text"> or something like <textarea> ...
There are quite some ways to access that, but you can give your form field somme attributes like id=field, and target the element with the getElementById method.
By the way, that's even shorter using jQuery.
0
JavaScript variables