title: How can I make this javascript Up/Down Numeric input box using Jquery?
body: <p>Ok I have this Up/Down Numeric input box :</p>
  
  <p><strong>Markup:</strong></p>
  
  <pre><code>&lt;div class="rotatortextbox"&gt;
      &lt;asp:TextBox ID="txtrunningtimeforfirstlot" ClientIDMode="Static" runat="server"&gt;0&lt;/asp:TextBox&gt;
      In mins)
  &lt;/div&gt;
  &lt;div class="rotatorarrow"&gt;
      &lt;input id="UpButton" value="&amp;#9650;" type="button" onmousedown="timerID = setInterval(function(){FactUp()},100);" onmouseup="clearInterval(timerID);" /&gt;
      &lt;input id="DownButton" value="&amp;#9660;" type="button" onmousedown="timerID = setInterval(function(){FactDown()},100);" onmouseup="clearInterval(timerID);" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>var timerID = 0;
  function FactDown() {
      var obj = document.getElementById("&lt;%=txtrunningtimeforfirstlot.ClientID%&gt;");
      var num = parseInt(obj.value)
  
      if (isNaN(num)) {
          return;
      }
  
      num -= 1;
      obj.value = num;
  }
  
  function FactUp() {
      var obj = document.getElementById("&lt;%=txtrunningtimeforfirstlot.ClientID%&gt;");
      var num = parseInt(obj.value);
  
      if (isNaN(num)) {
          return;
      }
  
      num += 1;
      obj.value = num;
  }
  </code></pre>
  
  <p>This works perfectly fine. But how can this be made in Jquery such that I do not need to create separate <code>FactUp</code> /<code>FactDown</code> functions for every such textbox?</p>
  
  <p>I was hoping to find out a way of doing it using .closest method of Jquery. This way I would not have to specify #id of textboxes again and again.</p>