Saving Old Value

testing saving value

by mark edwards

HTML

<input id='marksTest'  onFocus="this.oldValue = this.value;" type='text'/>

<button type='button' 
   onClick='javascript: console.log("NEW VALUE: " + document.getElementById("marksTest").value); 
   console.log("OLD VALUE: " + document.getElementById("marksTest").oldValue);'>
Click to show values in console
</button>
            
<p>
https://stackoverflow.com/questions/1909992/how-to-get-old-value-with-onchange-event-in-text-box/8419309#comment123057316_8419309
</p>

<p>
open browser console, click button, enter value, click button, CHANGE value, click buttton again
</p>