Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check when input number value goes up or down

let previous_value;

document.getElementById("input").addEventListener("change", function() {
  let value = document.getElementById("input").value;
  if (previous_value > value) {
    console.log("Decreased");
  } else if (previous_value < value) {
    console.log("Increased");
  }
  previous_value = value;
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #input #number
ADD COMMENT
Topic
Name
2+1 =