I want to use to events in my search input. I want to search when the user types and second when the user pastes the text.
The problem is that these events are fired together and immediately. Yes the paste is first but this does not help.
The same situation is with keyup, both of events are triggered but I want to know exactly the type and base on the event type do something.
<input id="textSearch" class="form-control" type="text" />
$("#textSearch").on("input paste", function (event) {
if(event.type === 'paste'){
console.log(event.type + " is fired paste: " + event.type);
}else{
console.log(event.type + "is fired input: " + event.type);
}
if (table.columns(3).search()[0] != this.value) {
table.columns(3).search(this.value).draw();
}
});