jQuery figuring out if parent has lost 'focus'

后端 未结 7 1898
小鲜肉
小鲜肉 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:32

    Try this

    $('li.primaryMenuItem:last li a:last').blur([do whatever you need to do])
    

    Logically, if your user tabs out he must have been focusing the last anchor.

    You could even set up your own event handler like so:

    $('li.primaryMenuItem:last').bind('myblur', function() ...);
    

    and call it within the last anchors blur event:

    ...blur(function() {
        $(this).parents('li.primaryMenuItem').trigger('myblur'); ...
    
    0 讨论(0)
提交回复
热议问题