Using Javascript to compare two input numbers in HTML?

Values from inputs are retrieved as strings, you need to convert it to number. Try this:

value1 = +document.First_num.value;
value2 = +document.last_num.value;

Also, try to be consistent when naming your input, why caps for one and lowercase for the other?

Leave a Comment