How do I get the value from a form input? All solutions I found on web recommends using getElemebyId().value but it doen't work for my case. File index.html contains:
</body>
<form id = "myForm" style="font-size:14" class="form1">
<input id="myNumber" type="number" name="quantity" min="1" max="21">
</form>
<script src="myscript.js"></script>
</body>
File myscript.js contains:
var quantityFromUser = document.getElementById("myNumber").value;
But this doesn't work, the answer to this question states at method 1 that one can use:
document.getElementById('textbox_id').value
but this doesn't work either, .value is not even a method for my case, only thing I get is .nodeValue.