How to know the cause of the response onBlur



  • On the. divin which an outgoing list is organized, which appears if the user presses on. input#finder♪ I need this list closed if the user pressed past this diva. If the user pressed input#finder - The sword must not disappear.
    The annex uses Angular and jQuery.

    <input id="finder" type="text">
    <div class="finder-list">
      <ul>
        ...
      </ul>
    </div>
    


  • I'd suggest we do something different.

    You need to create a click processor attached to the paper. That's a processor that's gonna start with a LUBOM click anywhere on the page.
    Inside of the processor:

    1. Find out if the list is open.
      and if open
    2. Find out what the element triggered. If it's not. input#finder - Close the list.

    Something like that:

    $(document).click(function(event) {
        if ($('#id-списка]:visible').length) {
            if ($(event.target).attr('id')!='finder') {
                 [спрятать список]
            }
        }
    });
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2