Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to compare previous value with current in jquery

var previousText = null;
function foo() {
  var currentText = $(".showText").text();
  if (previousText == currentText) {
    $(".showText").html("same text");
  }
  previousText = currentText;
}
 
PREVIOUS NEXT
Tagged: #compare #previous #current #jquery
ADD COMMENT
Topic
Name
1+2 =