2013-10-29 44 views
-1

我可以在我的主菜單上通過jquery添加一些html。我如何可以通過jquery刪除最後一項html?通過jquery刪除一些div或一些html?可能?

$(document).ready(function() { 
    $(".menubarinner ul li").after("<div class='sperator'></div>"); 
}); 
+3

'$('。separator')。remove()'? – Krishna

+0

https://www.google.com/search?q=jquery+remove - 難道你難以獨立完成......? – CBroe

+0

我有六裏。所以,我只是刪除最新的spector @Cbroe我真的使用它。比我困惑。 –

回答

1

除去最新的文檔sperator

所以$('.separator').last().remove();

http://api.jquery.com/last/

+0

多數民衆贊成多多少少我想感謝快速幫助@sdespont。 –

0

你只要找到UL的最後李然後刪除 -

$('ul li:last-child').remove();