Bound keypress event on search box not triggering on return?
Bound keypress event on search box not triggering on return?
~EDIT~ - Please ignore found and fixed the issue.
I am trying to setup a DataTables search field to work with a scanner.
the scanner enters the bar code characters then adds a carriage return.
I have managed to bind an event to the search box on keypress and I get an alert when I press keys... EXCEPT for when I press keys such as backspace or return....
Am I missing something?
here is the code in question.... (Test Case Example - https://jsfiddle.net/g51m817g/ )
$("#search_filter").unbind("keypress");
$("#search_filter" ).bind("keypress", function(e) {
if (e.keycode !== 13 || e.keycode !== 10) {
alert(String.fromCharCode(e.keycode ));
Table.fnFilter(this.value )
}else{
alert(String.fromCharCode(e.keycode ));
}
});