SO - 28250520 - Get Old and New typed value from input element

by codeSpy

HTML

<input type="text" name="quantity-row_111" value="1" id="quantity-row_111"/>

JavaScript

var oldvalue = document.getElementById("quantity-row_111").value;
var newvalue;
var inputBox = document.getElementById("quantity-row_111");
inputBox.onchange = function(){
    alert(oldvalue);
    newvalue = document.getElementById("quantity-row_111").value;
    oldvalue = newvalue;
};