Variables | Sololearn: Learn to code for FREE!



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?

2/12/2018 2:26:09 AM


4 Answers

New Answer


what input type you are using for getting inputs?


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.


JavaScript variables


JavaScript variables?