One way to protect against the problem is to save the old field value and check it before executing the real function that you want to execute in your handler input. This is how I fixed it in one of my applications.
For example:
$(document).ready(function () {
var $input = $("#input");
var $msg = $("#msg");
var old_value = $input.val();
$input.on("input", function () {
var new_value = $input.val();
if (new_value !== old_value) {
$msg.text(new_value.length);
old_value = new_value;
}
});
});
This prevents the action when the field does not change.
Louis source
share