I have a text Box and a Value poplulated in it when page loads. Now If user chanegs any thing in text box, then I want to get the Changed Value(New Value) and Old Value but
I am not sure, but maybe this logic would work.
var d = 10;
var prevDate = "";
var x = 0;
var oldVal = "";
var func = function (d) {
if (x == 0 && d != prevDate && prevDate == "") {
oldVal = d;
prevDate = d;
}
else if (x == 1 && prevDate != d) {
oldVal = prevDate;
prevDate = d;
}
console.log(oldVal);
x = 1;
};
/*
============================================
Try:
func(2);
func(3);
func(4);
*/