I have code that looks like this:
(我的代码看起来像这样:)
<div id="header">
<ul class="tabs">
<li><a href="/user/view"><span class="tab">Profile</span></a></li>
<li><a href="/user/edit"><span class="tab">Edit</span></a></li>
</ul>
</div>
I'd like to use jQuery to add the following to the list:
(我想使用jQuery将以下内容添加到列表中:)
<li><a href="/user/messages"><span class="tab">Message Center</span></a></li>
I tried this:
(我试过这个:)
$("#content ul li:last").append("<li><a href="/user/messages"><span class="tab">Message Center</span></a></li>");
But that adds the new li
inside the last li
(just before the closing tag), not after it.
(但是,这增加了新li
最后内 li
,后不是(在结束标记之前)。)
What's the best way to add this li
? (添加这个li
的最佳方法是什么?)
ask by Eileen translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…