First of all, I'm sorry, I do not know what to call these keys (ENTER, F1, HOME, etc.).
In fact, I am creating an input box that onkeyup calls a function. When a user enters at least two keys, my function is called and the corresponding search results are displayed using AJAX. The problem is that the user presses the arrow keys, HOME, END, etc., Then also my ajax is called, which I do not want. And pressing the F5 key to reload the page while focusing on the input does not reload the page, instead it calls AJAX, so this is a big problem for me.
$('input[name=\'search\']').on(keyup, function(e) { if ($('input[name=\'search\']').val().length >= 2) {
I want to add an extra expression in if that checks if an invisible key is pressed or not. How -
if ($('input[name=\'search\']').val().length >= 2 && (EXPRESSION FOR VISIBLE KEYS)) {
If any visible key is pressed, ajax is called, otherwise it is not.
I do not know how to achieve this. Since I can not do e.keycode == '65' for each key, such as A, B, C, \, =, +, 1,2,3, etc.
Is there a ready-made library for checking this or any other way to do this? Please help me.