compare previous and new value javascript code example
Example: how to compare previous value with current in javascript
var previousText = null;
function foo() {
var currentText = $(".showText").text();
if (previousText == currentText) {
$(".showText").html("same text");
}
previousText = currentText;
}