复制代码 代码如下:
筛选:<input type="text" id="sea" />
<table width="100%" id="se">
<thead>
<tr><th></th><th>姓名</th><th>性别</th><th>地址</th></tr>
</thead>
<tbody>
<tr class="parent" id="row_01"><td colspan="3">一班</td></tr>
<tr class="child_row_01"><td></td><td>大爷</td><td>男10</td><td>武汉1</td></tr>
<tr class="child_row_01"><td></td><td>大爷</td><td>男9</td><td>武汉2</td></tr>
<tr class="child_row_01"><td></td><td>大爷</td><td>男8</td><td>武汉3</td></tr>
<tr class="parent" id="row_02"><td colspan="3">二班</td></tr>
<tr class="child_row_02"><td></td><td>大爷</td><td>男7</td><td>武汉4</td></tr>
<tr class="child_row_02"><td></td><td>大爷</td><td>男6</td><td>武汉5</td></tr>
<tr class="child_row_02"><td></td><td>大爷</td><td>男5</td><td>武汉6</td></tr>
<tr class="child_row_02"><td></td><td>大爷</td><td>男4</td><td>武汉7</td></tr>
<tr class="parent" id="row_03"><td colspan="3">三班</td></tr>
<tr class="child_row_03"><td></td><td>大爷</td><td>男3</td><td>武汉8</td></tr>
<tr class="child_row_03"><td></td><td>大爷</td><td>男2</td><td>武汉9</td></tr>
<tr class="child_row_03"><td></td><td>大爷</td><td>男1</td><td>武汉10</td></tr>
</tbody>
</table>
<script type="text/javascript" >
$(function(){
$("#sea").keyup(function(){
$("#se tbody tr").hide().filter(":contains('"+$(this).val()+"')").show();
}).keyup();
});
</script>
复制代码 代码如下:
// jquery表格内容筛选
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="/UploadFiles/2021-04-02/jquery-1.6.2.js"><script>
$(function(){
$('tr.parent').click(function(){
$(this).toggleClass("selected").siblings('.child_'+this.id).toggle();
});
});
</script>
<style>
.selected{background:red};
</style>
<title>Untitled Document</title>
</head>
<body>
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
</thead>
<tbody>
<tr class="parent" id="row_01">
<td colspan="2">人力部</td>
</tr>
<tr class="child_row_01">
<td >脚本</td>
<td>20</td>
</tr>
<tr class="child_row_01">
<td >脚本</td>
<td >20</td>
</tr>
<tr class="child_row_01">
<td >脚本</td>
<td >20</td>
</tr>
<tr class="parent" id="row_02">
<td colspan="2">技术部</td>
</tr>
<tr class="child_row_02">
<td >脚本</td>
<td >20</td>
</tr>
<tr class="child_row_02">
<td >脚本</td>
<td >20</td>
</tr>
<tr class="child_row_02">
<td >脚本</td>
<td >20</td>
</tr>
</tbody>
</table>
</body>
</html>
jquery,筛选,表格
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 纪钧瀚《钢琴阅读时光 雨中书店聆听轻音乐》[FLAC/分轨][399.62MB]
- 证声音乐图书馆《走向自然 疗心爵士乐》[320K/MP3][87.4MB]
- 证声音乐图书馆《走向自然 疗心爵士乐》[FLAC/分轨][184.94MB]
- 陈慧娴.2018-Priscilla-Ism演唱会3CD(2024环球红馆40复刻系列)【环球】【WAV+CUE】
- 郑秀文.1999-我应该得到(国)【华纳】【WAV+CUE】
- 陈家慧.2011-钢琴酒吧2CD【龙吟唱片】【WAV+CUE】
- 证声音乐图书馆《雨季 蓝调吉他 Rainy Blues》[320K/MP3][45.01MB]
- 证声音乐图书馆《雨季 蓝调吉他 Rainy Blues》[FLAC/分轨][109.13MB]
- 赞多《序章》[320K/MP3][45.54MB]
- 许巍.2004-每一刻都是崭新的【步升大风】【WAV+CUE】
- 群星.2024-四方馆影视原声带【韶愔音乐】【FLAC分轨】
- 陈雷.1997-安锁咧【金圆唱片】【WAV+CUE】
- 关淑怡.2013-MY.FAVORITE.SK.3CD【环球】【WAV+CUE】
- Sweety.2006-花言乔语【丰华】【WAV+CUE】
- 李恕权.2003-回·20年全精选2CD【SONY】【WAV+CUE】