[Solved] javascript form submission one value should greater than other value x>y [closed]


You compare strings instead of numbers and have to cast it to Integer.

Change your function to:

verify = function() {
     var x = document.getElementById("max_temp").value;
     var y = document.getElementById("min_temp").value;
     if (parseInt(x) < parseInt(y)) {
      alert("Sorry, you don't have enough points");
      return false;
     }
    }

Here is a working Fiddle

1

solved javascript form submission one value should greater than other value x>y [closed]