I have an input field and I need to figure out what the last character is that the user is typing. This could be the last letter in the input but it could also be anywhere in the input field.
I need something like this:
var timerid;
$("#input").on("propertychange change click keyup input paste",function(e){
var value = $(this).val();
if($(this).data("lastval")!= value){
$(this).data("lastval",value);
//console.log(difference between lastval and value or something similar to get the last character the user types in the input)
clearTimeout(timerid);
timerid = setTimeout(function() {
//change action
console.log(value);
input_array(value)
},400);
};
});