//出自http://www.cnblogs.com/ahjesus 尊重作者辛苦劳动成果,转载请注明出处,谢谢!
$(document).ready(function () { var dom = $("span"); //出自http://www.cnblogs.com/ahjesus 尊重作者辛苦劳动成果,转载请注明出处,谢谢! $(dom[0]).remove(); console.log(dom.length) //5 console.log($(dom).length) //5 console.log($("span").length) //4 console.log($(dom[0]).text()) //A })
如果用变量才存储jquery对象,在删除后,删除的对象还是缓存存在的,在进一步做其他操作的时候,缓存对象清除