我有一个类.answers的ul。
如何定位该列表中的最后一个li?
我有:
$(this).parent().children(".answers li:last")
这针对答案很好:
$(this).parent().children(".answers');
最后一位遇到麻烦
HTML
<div class="control-group">
<label class="control-label">Answers:</label>
<div class="controls">
<ul class="answers">
<li class="answer">
<input class="input-xxlarge answerInput" type="text" placeholder="Answer A" name="answer">
<button type="button" class="btn btn-inverse deleteAnswerBtn">x</button>
</li>
<li class="answer">
<input class="input-xxlarge answerInput" type="text" placeholder="Answer A" name="answer">
<button type="button" class="btn btn-inverse deleteAnswerBtn">x</button>
</li>
</ul>
<button type="button" class="btn addAnswerBtn">+</button>
</div>
</div>