Get value from input text box - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Get value from input text box

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
function myFunction() {//from   ww w. j a v  a 2s.  c om
var x=document.getElementById("Qty").value;
var y=document.getElementById("QtyRemaining").value;
 if(y>x) {
  console.log("exceeded the Qty remaining");
  document.getElementById("Qty").value = "";
 }
}

      </script> 
   </head> 
   <body> 
      <input type="text" id="Qty" onBlur="myFunction()"> 
      <input type="text" id="QtyRemaining" value="2323">  
   </body>
</html>

Related Tutorials