Traditional Culture Encyclopedia - Photography major - Ask the master a CSS+JQ effect, problem description: click A to change color in navigation, and the previous one will be restored to the default color when clicking another A.
Ask the master a CSS+JQ effect, problem description: click A to change color in navigation, and the previous one will be restored to the default color when clicking another A.
< script type="text/javascript">
$(function(){
$("ul li a").click(function(){
$(this).addClass("cur").parent().siblings().children("a").removeClass("cur");
})
})
< /script>
Your writing is to remove the sibling element of a
There is only one A under each li
Here A has no sibling element
What you want to remove should be the child element A of the sibling element of A's parent element li.
- Related articles
- When will the terraces in Youxian open?
- 5-day itinerary for Shangri-La core scenic spots
- Urban management articles
- Where can I find children's Hanfu in Yulin?
- Integrity depends on self-discipline debate materials
- [High score] The rewind problem of traditional SLR cameras?
- How to choose a SLR camera
- Introduction to astrophotography
- What position does the light encounter crew have?
- Where does the beauty of human appearance come from?