jQuery add class to current li and remove prev li when click inside li a

后端 未结 7 531
执笔经年
执笔经年 2020-12-28 08:55

here is html:

7条回答
  •  悲&欢浪女
    2020-12-28 09:51

    $('ul li a').click(function(){
      $('ul').children().removeClass('current');
      $(this).addClass('current');
    });
    

    Hope, this will works for you..

提交回复
热议问题