title: compare two input values in input validation html javascript?
body: <p>I want to compare two inputs minimumN and maximumN, and display an alert if the logic is not satisfied, I have the following code:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Minimum N&lt;/th&gt;
          &lt;td&gt;
              &lt;input id="minN" onkeyup="MinimumNValidate()" type="text" maxlength="50"&gt;
          &lt;/td&gt;
          &lt;th&gt;Maximum N&lt;/th&gt;
          &lt;td&gt;
              &lt;input id="maxN" onkeyup="MaximumNValidate()" type="text" maxlength="50"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function MinimumNValidate() {
      var min = document.getElementById("minN").value;
      var max = document.getElementById("maxN").value;
      if (min &gt; max) {
          alert("Minimum value must be lesser than maximum value.");
      }
  }
  
  function MaximumNValidate() {
      var min = document.getElementById("minN").value;
      var max = document.getElementById("maxN").value;
      if (max &lt; min) {
          alert("Maximum value must be greater than minimum value.");
      }
  }
  </code></pre>
  
  <p>but this is not working, and the alert is being displayed even when the minN is less than maxN, can you point out the mistake in my code ?</p>