I've just made a form for the first time.
I've a problem accessing the values of that form and storing them into variables, later used by functions. Whenever you submit the form, it take you to another webpage. A JavaScript file is attached to both form and the another webpage.
What I've Tried - [If i give id to the properties]
var someVariable = document.getElementById("Some id").val();
console.log(someVariable); // It shows a error in console, not the value.
Another try
var someVariable = document.forms["Form Name"]["Property name"].value();
console.log(someVariable);
Some error in console.
The Form
<div id="ques">
<ul>
<form name="myForm" action="Answer.html" method="get">
<li>What cuisine?(You can leave it empty)<br>
<input list="Cuisines" class="normal" type="text" name="Cuisine" placeholder="Like Chinese" pattern="Chinese|North Indian|Italian|American">
<datalist id="Cuisines" autocomplete="off">
<option value="Chinese"></option>
<option value="North Indian"></option>
<option value="Italian"></option>
<option value="American"></option>
</datalist></li>
<li>On a scale of 1 to 10, how much hungry are you?<br><input class="normal" type="number" name="hunger" min="1" max="10" required></li>
<li><input class="special" type="checkbox" name="Personality" value="Vegetarian"checked> Vegetarian
<input class="special" type="checkbox" name="Personality" value="Non-Vegetarian" > Non-Vegetarian
</li>
<li>On a scale of 1 to 10, how much healthy do you want the food to be?<br><input class="normal" type="number" name="Calories" min="1" max="10" required></li>
<li>What will be the max cost of the food, per person?<br>(Quality of the food will be affected)<br><input class="normal" type="number" name="quality" placeholder=" Like 400" step="50" required></li>
<li>How many people?<br><input class="normal" type="number" name="Amount of people" required></li>
<li><a href="Answer.html"><input class="normal" type="submit"></a></li>
</form>
</ul>
</div>
EDIT
I works, with .value, how can i get it to log on both of the Webpages.
.valueinstead of.value().val()is the jQuery version of.value, not.value()..valueinstead of.value()as he/she tried.value()as a second attempt.