jQuery figuring out if parent has lost 'focus'

后端 未结 7 1902
小鲜肉
小鲜肉 2020-12-16 05:39

I\'m stuck on figuring out the logic to make a drop down menu keyboard accessible.

The HTML is structured as such (extra class names used for clarity):



        
7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 06:18

    Use the new jquery 1.4 functions: focusin and focusout instead of blur and focus. Here's how focusout differs:

    The focusout event is sent to an element when it, or any element inside of it, loses focus. This is distinct from the blur event in that it supports detecting the loss of focus from parent elements (in other words, it supports events bubbling).

提交回复
热议问题