我有以下的jQuery:为什么我的:nth-child(2)选择器不能在我的jQuery中工作?
$(".score-window a:first-child").click(function() {
$(".score-window").hide();
$(".login-window").show();
});
$(".score-window a:nth-child(2)").click(function() {
$(".score-window").hide();
$(".register-window").show();
});
这是挂在下面的HTML:
<div class="score-window">
<i class="icon-remove" title="Close"></i>
<p>In order to view your score, you have to <a href="#">log in</a>.</p><br>
<p>Don't have an account yet? <a href="#">Register</a>! Totally free and you'll get the ability to save your scores.</p>
</div>
我只有在score-window
类两个环节,所以我不明白为什么这ISN没有工作。
请注意,'n-type-type'可能在这里更有用,因为第一个孩子是'i'而不是'p'。 – 2013-02-15 13:02:45