Javascript 使用jquerywhere类删除th标记
如何使用jquerywhere类删除th标记 我的桌子:Javascript 使用jquerywhere类删除th标记,javascript,jquery,Javascript,Jquery,如何使用jquerywhere类删除th标记 我的桌子: <table> <thead> <th class="NoRemove">1</th> <th>2</th> <th class="NoRemove">3</th> <th class="NoRemove">4</th> <th class="NoRemove">5</th> <th>
<table>
<thead>
<th class="NoRemove">1</th>
<th>2</th>
<th class="NoRemove">3</th>
<th class="NoRemove">4</th>
<th class="NoRemove">5</th>
<th>6</th>
<th>7</th>
</thead>
</table>
我需要将上述代码写入jQuery。但是我不知道怎么写
//dom ready handler - wait the execution of the passed function till the dom is loaded
jQuery(function(){
//fetch all the th elements which does not have the class NoRemove and remove it
$('th:not(.NoRemove)').remove()
})
参考:
.not()
或:not()
jQuery方法。
//dom ready handler - wait the execution of the passed function till the dom is loaded
jQuery(function(){
//fetch all the th elements which does not have the class NoRemove and remove it
$('th:not(.NoRemove)').remove()
})
$(function(){
$('table th').filter(':not(.NoRemove)').remove();
});
$('table th:not(".NoRemove")').remove();