my textbox ALWAYS returns with field is not a number, even if it is.
HTML
<form name = garysForm>
Number of adults: <input type="number" size="6" id="ofAdults" name="adultBox" min="0" max="50" required><br>
Number of children: <input type="number" size="6" id="ofChild" min="0" max="50" required><br>
Date:<input type="text" name="date" id="datepicker" required><br>
<Button type="button" onclick="BookingFare(); return false;">Calculate</button><br>
</form>
Javascript
var field = document.forms["garysForm"]["adultBox"].value;
if (isNaN(field.value)) {
alert('Please enter a valid number');
}
document.formsis a really poor way to get an element that has an IDvalueTWICE, which is the real problemif (isNaN(field)) {