jquery detect input value change code example
Example 1: Determine if text is written into input text in jquery
var timerid;
$("#input").on("input", function(e) {
var value = $(this).val();
if ($(this).data("lastval") != value) {
$(this).data("lastval", value);
clearTimeout(timerid);
timerid = setTimeout(function() {
console.log(value);
}, 500);
};
});
Example 2: value change event jquery
$("#input").change(function(){
alert("The text has been changed.");
});
Example 3: javascript detect input change
$('#inputID').on("change keyup paste", function() {
});