jQuery lose focus event

前端 未结 5 1432
小鲜肉
小鲜肉 2020-12-22 17:15

I\'m trying to show up a container if a input field gets the focus and - that\'s the actual problem - hide the container if focus is lost. Is there an opposite event for jQu

5条回答
  •  旧时难觅i
    2020-12-22 17:34

    Use blur event to call your function when element loses focus :

    $('#filter').blur(function() {
      $('#options').hide();
    });
    

提交回复
热议问题