On child hover change the css of Parent

后端 未结 5 2162
野性不改
野性不改 2021-02-20 02:41

I want to change the css of parent on hover of Child element.

5条回答
  •  渐次进展
    2021-02-20 03:19

    Here you can go..

    For Apply CSS..
    
    $("#main-menu li").mouseover(function()
    { 
          $("#main-menu a:eq(0)").css({'color':'blue','font-weight':'bold'});
    });
    
    For Remove CSS..
    
    $("#main-menu li").mouseout(function()
    { 
         $("#main-menu a:eq(0)").removeAttr("style");
    });
    

    [link] (https://jsfiddle.net/aj23whnb/)

提交回复
热议问题