我正在寻找答案,但是找不到希望解决的问题。
我想从表中删除一些td。td还没有分类或ID。
Blabla | 25,2 | 27,6 | 22,4 | 23,0 | 26,3 | 28,5 | 28,0 |
---|
这里我的jQuery代码非常简单:
jQuery('table tbody tr td').each(function () { if (jQuery(this).index() < 3) { alert(jQuery(this).text()); // display the good td value jQuery(this).remove(); // remove all td } });
我认为,如果j Query(this).text
返回正确的值jQuery(this)
,则循环中的当前td也是如此。但是jQuery(this).remove()
删除所有td,我不明白为什么。如果有人可以向我解释.. :)