+ 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?

12th Feb 2018, 2:26 AM
Allison
Allison - avatar
3 Answers
+ 1
what input type you are using for getting inputs?
12th Feb 2018, 2:47 AM
Praful Jangid
Praful Jangid - avatar
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.
12th Feb 2018, 3:23 AM
Andrei
0
JavaScript variables
2nd Apr 2018, 6:12 PM
nathain