There is input with ajax search.

<div> <input type="text"> <button>Поиск</button> <div class="tip">Тут результаты</div> </div> 

input.keyup is a search event.

 input.focusout(function() { }); 

This event hides the tip. But when you click on the tip - the focus is removed and the link does not go - it closes. How to fix it?

  • How about using a timeout so that the tip does not close immediately? - Anton Zikov
  • And if the user simply clicks on the tip, without clicking on the link - Gleb
  • Then it will still close on timeout. - Anton Zikov

1 answer 1

Try adding a deferment to hide the tip, something like this (disappears after 800 milliseconds):

 input.focusout(function() { $("#tip").delay(800).hide(); }); 
  • setTimeout (function () {$ ("# tip"). hide ();}, 500); - Gleb