li menu needs class of “selected”

前端 未结 7 1485
抹茶落季
抹茶落季 2021-01-15 18:20

when the user clicks on a menu tab i want it to remain selected with it a white button.

here is my attempt but its not working. if you click the home button it does

7条回答
  •  无人共我
    2021-01-15 18:30

    As others stated you dont have a .selected class also your js will set all li elements to selected when one is clicked you may want to change it to this on the second line

    $('#navigation  li').click(function() {
       $(this).addClass('selected');
    });
    

提交回复
热议问题