`

jquery删除除表头同级所有dom

阅读更多
/**
 * 清除表格内容(保留表头)
 */
function clearTr(){
  //清除表格节点内容(不包含表头)
  $("#roleInfo .c666").nextAll().each(function(i){
     $(this).remove();
  });
}


<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin: auto;">
    <tr>
    <td height="35" align="left" bgcolor="#EAF4EA" style="padding-left:10px; /*display: none;*/ ">
 	         	<input id="role_seach_txt" type="text" style="width:150px; height:19px;" />
 	            <input id="role_seach_btn" type="button" value="搜索" style="background:url(../img/btn_search.gif); width:57px; height:25px; border:0;"  />
             </td>
             <td width="35%" height="35" align="left" bgcolor="#EAF4EA" style="padding-left:10px;">
 	          	<input id='toolbar_btn_add' name="toolbar_btn_add"  type="button" value ="添加" class="btn_666"/> 
 		     	<input id='toolbar_btn_mod' name="toolbar_btn_mod"  type="reset" value="修改" class="btn_666"/>
 			    <input id='toolbar_btn_del' name="toolbar_btn_del"  type="button" value="删除" class="btn_666"/>
           	</td>
         </tr>
       </table>
       <br>
        <table id="roleInfo" width="95%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#D7E6CC" style="margin: auto; font-size: 12px;">
         <tr class="c666">
           <th height="20" width="2%" align="left" bgcolor="#F2F9F2">序号</th>
           <th width="10%" bgcolor="#F2F9F2">角色编号</th>
           <th width="10%" bgcolor="#F2F9F2">角色名称</th>
         </tr>  </table>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics