如图,选择复选框,点击“隐藏”按钮,隐藏选中行

1、JavaScript代码:

    function getCheckedIds() {
var checkedSubject = $('#showSbgl input[name=checkIds]:checkbox:checked');
checkedSubject.each(function() {
$(this).parents("tr").hide();
});
}

(1)checkedSubject :根据table表id:showSbgl ,获取选中的复选框id:input[name=checkIds]:checkbox:checked',最后把选中的复选框给checkedSubject

(2)checkedSubject.each(function(){}):遍历checkedSubject,

(3)$(this):每一个选中的复选框。

(4)$(this).parents("tr"),选中的复选框所在那一行,hide():隐藏

        <table id="showSbgl" >
<thead>
<tr class="yogurt_tab_back" onmouseover="this.className='yogurt_tab_trhover'" onmouseout="this.className='yogurt_tab_back'">
<th width="3%"><input type="checkbox" name="sbglId" onClick="allchecked(this)"></th>
<th width="10%">设备名称</th>
<th width="10%">设备类型</th>
</tr>
</thead>
<tbody id="sbglTb">
<c:forEach var="sbgl" items="${resultMap.resultList}" varStatus="status">
<tr>
<td><input type="checkbox" id="checkIds" name="checkIds"></td>
<td>${sbgl.sbmc }</td>
<td>${sbgl.sblx }</td>
</tr>
</c:forEach>
</tbody> </table>

js根据选中的复选框,隐藏那一行的更多相关文章

  1. js删除选中的复选框中的父辈。

    function scsx(){ var cb=document.getElementsByName('checkbox') if(confirm('删除?')){ for (var i=0;i< ...

  2. bootstrap table 复选框选中后,翻页不影响已选中的复选框

    使用的 jquery版本为 2.1.1 在项目中发现bootstrap table的复选框选中后,翻页操作会导致上一页选中的丢失,api中的 bootstrapTable('getSelections ...

  3. 选中没有选中的复选框,匹配含有某个字符串的正则,json取值的两种方法,把变量定义在外面跟里面的区别

    一.筛选没有选中的复选框:not("input:checked") 二.匹配有VARCHAR的字符串:".*VARCHAR.*?" 三.json取值的两种方法 ...

  4. jQuery分别获取选中的复选框值

    function jqchk(){  //jquery获取复选框值   var s='';   $('input[name="aihao"]:checked').each(func ...

  5. 单选框 复选框 隐藏之后,绑定的change事件在ie中失效的问题

    有时候需要对单选框和复选框进行美化,就需要在<input type="radio">和<input type="checkbox">元素 ...

  6. element表格点击行即选中该行复选框

    关键代码如下 <el-table ref="multipleTable" :data="tableData" highlight-current-row ...

  7. ztree点击节点实现选中/取消复选框

    效果 代码 在js中初始化tree时 设置复选框操作只影响子节点 复选框事件,想怎么处理就怎么处理

  8. 设置checkbox不能选中,复选框不能选中

    Web开发:设置复选框的只读效果 在Web开发中,有时候需要显示一些复选框(checkbox),表明这个地方是可以进行勾选操作的,但是有时候是只想告知用户"这个地方是可以进行勾选操作的&qu ...

  9. jQuery选中该复选框来实现/全部取消/未选定/获得的选定值

    <!DOCTYPE html> <html> <head> <script type="text/javascript" src=&quo ...

随机推荐

  1. 常用模块之 time,datetime,random,os,sys

    time与datetime模块 先认识几个python中关于时间的名词: 时间戳(timestamp):通常来说,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏移量.我们运行“ty ...

  2. linux下连接无线网出现nl80211: Could not configure driver mode nl80211: deinit ifname=wlan1 disabled_11b_rates=0 wlan1: Failed to initialize driver interface

    一.背景1.1 jello@jello:~$ lsb_release -aNo LSB modules are available.Distributor ID:    UbuntuDescripti ...

  3. Zookeeper一致性协议原理Zab

    ZooKeeper为高可用的一致性协调框架,自然的ZooKeeper也有着一致性算法的实现,ZooKeeper使用的是ZAB协议作为数据一致性的算法, ZAB(ZooKeeper Atomic Bro ...

  4. v-pre原样输出&&v-once只加载一次

    html <div id="app"> <div v-pre>{{message1}}</div><!--原样输出--> <b ...

  5. java项目中.classpath,.settings,.project,mymetadata文件的作用

    今天犯了一个错误,误修改了本地的.classpath文件,导致项目好多地方报错,之前也没有仔细的研究过项目中的一些生成文件的作用. 今天特此进行记录. 不管我们在eclipse中新建任何的Java项目 ...

  6. poj 3468 A Simple Problem with Integers 线段树加延迟标记

    A Simple Problem with Integers   Description You have N integers, A1, A2, ... , AN. You need to deal ...

  7. shell 截取字符串

    vvar='{"floor":2,"hotelid":"3433bbb"}' #vvar='{"hotelid":&qu ...

  8. cookie(2)

    转载,原文地址 https://segmentfault.com/a/1190000004743454 一.引言 随着浏览器的处理能力不断增强,越来越多的网站开始考虑将数据存储在「客户端」,那就不得不 ...

  9. IDEA配置GIT

    注:此方法可用于配置gitlab也可用于配置github 1.在github中创建一个账号:https://github.com/join?source=header-home 2.下载并安装git: ...

  10. springboot整合redis缓存

    使用springBoot添加redis缓存需要在POM文件里引入 org.springframework.bootspring-boot-starter-cacheorg.springframewor ...