Answers for "check when input number value goes up or down"

0

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;
});
Posted by: Guest on August-24-2020

Code answers related to "check when input number value goes up or down"

Code answers related to "Javascript"

Browse Popular Code Answers by Language