Onclick Show / Hide Multiple Divs Jquery

前端 未结 5 1234
萌比男神i
萌比男神i 2021-01-22 14:24

I need to create navigation that shows / hides multiple divs.

Here is what I need to be able to do: If a user clicks on any of the \"options

5条回答
  •  感情败类
    2021-01-22 14:27

    See http://jsfiddle.net/XwN2L/415/ . It removes the class "selected" from all .showSingle anchors, then adds the class "selected" to the clicked anchor. Also, it handles the onload problem by hiding all the .targetDivs and showing only the first one.

    EDIT: Should highlight the first option in red on page load too. http://jsfiddle.net/XwN2L/421/

提交回复
热议问题