Update input text box content - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Update input text box content

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
function inc()/*from w  ww.  j  av a2 s  .  c  om*/
{
document.content.quant.value++;
event.preventDefault();
}
function dec()
{
document.content.quant.value--;
event.preventDefault();
}

      </script> 
   </head> 
   <body> 
      <form name="content"> 
         <input type="text" id="quant" value="0"> 
         <button onclick="inc()">increase</button> 
         <button onclick="dec()">decrease</button> 
      </form>  
   </body>
</html>

Related Tutorials