, JavaScript, :
- , - : var previousValue = $(this).val();
...
$("#myTextBox").on("change paste keyup", function () {
var preValue = $(this).val();
return function () {
var newValue = $(this).val();
consol.log('preValue: ' + preValue + 'newValue: ' + newValue);
preValue = newValue;
};
});
The return occurs after, so it works, I like the callback, it mainly happens after and so you can save both variables ...
source
share