CSS/JQuery Hover Affect Only Hovered Element and Not Parent

后端 未结 5 1506
说谎
说谎 2021-01-26 11:07

I have a list of nested items, each which has it\'s own edit link.

5条回答
  •  无人共我
    2021-01-26 11:51

    You need stop propagation of the event in the handler

    $(document).ready(function(){
      $('li').hover(
          function(e){
             e.stopPropagation();
               $(this).find('.editLink').show();
          },
          function(){
               $(this).find('.editLink').hide();   
          }
       );
    });
    

提交回复
热议问题