Handle focus event on input box - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event


Handle focus event on input box

Demo Code

ResultView the demo in separate window

function myFunction() {/* w ww. j a v a2  s  .  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 = "";

      <input type="text" id="Qty" onBlur="myFunction()"> 
      <input type="text" id="QtyRemaining" value="2323">  

Related Tutorials