onClick change list styles

前端 未结 3 1524
走了就别回头了
走了就别回头了 2021-01-22 02:52

Let\'s say I have a simple list:

  
  • 1
  • 2
3条回答
  •  遇见更好的自我
    2021-01-22 03:30

    Why change the style of the other? You may want to change the style of the clicked element.

    If so, you can use jQuery for that

    Example:

  • element 1
  • element 2
  • element 3
  • $('.notClicked').click(function() { $(this).addClass('active'); });

提交回复
热议问题