One way to guard against the problem is by storing the old value of your field and checking against it before performing the real function you want to perform in your input
handler. This is how I fixed it in one of my applications.
For instance:
$(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) {
// The actual work we want to perform when the field *really* changes.
$msg.text(new_value.length);
old_value = new_value;
}
});
});
This prevents acting when the field is not changing.