$("ul li[id]").remove()
一句即可,呵呵
选择器
基本
#id
element
.class
*
selector1,selector2,selectorN
层级
ancestor
descendant
parent >
child
prev +
next
prev ~
siblings
基本
:first
:last
:not(selector)
:even
:odd
:eq(index)
:gt(index)
:lt(index)
:header
:animated
:focus1.6+
内容
:contains(text)
:empty
:has(selector)
:parent
可见性
:hidden
:visible
属性
[attribute]
[attribute=value]
[attribute!=value]
[attribute^=value]
[attribute$=value]
[attribute*=value]
[attrSel1][attrSel2][attrSelN]
子元素
:nth-child
:first-child
:last-child
:only-child
表单
:input
:text
:password
:radio
:checkbox
:submit
:image
:reset
:button
:file
:hidden
表单对象属性
:enabled
:disabled
:checked
:selected
$("ul li").each(function(item){
var idstr = $(item).attr("id");
if(!idstr || idstr.length<=0)
{
$(item).remove();
}
});
$("ul li[id]").remove();