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.