title: Check if the number of a textbox is greater than number entered array of textbox's
body: <p>I am trying to compare value of a single text box value <strong>"totalmarkstoall"</strong> with multiple array of text box's <strong>"marksscored"</strong>, the below my java script is comparing as well on key up function.</p>
  
  <p>what am unable to do is if the value of <strong>"marksscored"</strong>  that perticuler text box is greater then the <strong>"totalmarkstoall"</strong> then is shows the pop up :But it should erase the value also or should not allow to enter.  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function scorecompare(idval) {
      var marksscored = idval;
  
      var totalmarkstoall = document.getElementById("totalmarkstoall").value;
      if (parseInt(marksscored) &gt; parseInt(totalmarkstoall))
      {
          alert("greater than Total Mrks");
      } else {
  
      }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input id="totalmarkstoall" type="number" style="border: 1px solid #dbdbdb;" placeholder="Enter Total Marks"&gt;&lt;/input&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;input type="text" name="marksscored[]" id="marksscored[0]" value="" onkeyup="scorecompare(this.value);"/&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;input type="text" name="marksscored[]" id="marksscored[1]" value="" onkeyup="scorecompare(this.value);"/&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;input type="text" name="marksscored[]" id="marksscored[2]" value="" onkeyup="scorecompare(this.value);"/&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>