Change background image of
  • on click of tag
  • 后端 未结 2 1439
    终归单人心
    终归单人心 2021-02-11 06:23

    html:

     
    • CO
    • <
    相关标签:
    2条回答
    • 2021-02-11 06:46

      Create a class for what you wish the active li tag to look like; and use the following:

      $('li').click(function(){
          $(this).addClass('active').siblings().removeClass('active');
      });
      

      This should affect only list items within the same ul tag.

      0 讨论(0)
    • 2021-02-11 06:52

      Try this

      $("li").click(function(){
          $("li").removeClass("active");
          $(this).addClass("active");
        });
      

      CSS for the new active class is

      li.active {
         background-image: url(../images/btnSelectedTab.png);
         color: black;
      }
      
      0 讨论(0)
    提交回复
    热议问题