搜索上级dom对象并隐藏,点击隐藏父元素
发布日期:2021-09-29 20:08:49
浏览次数:5
分类:技术文章
本文共 793 字,大约阅读时间需要 2 分钟。
类似页面如下:text to hide 1text to hide 2
$("input.chk").click(function(){ $(this).parent().parent().(".disabled").show(); }) ;实际使用.closest() 和 .find()更合适
$("input.chk").click(function(){ $(this).closest('tr').find(".disabled").show(); });当然也可以
$(this).parent().parent().find(".disabled").show();如果,有多行的话用.delegate()如下:
$("table").delegate("input.chk", "click", function(){ $(this).closest('tr').find(".disabled").show(); });
#.delegate() instead binds one handler to the table for all of the input.chk elements to bubble up to. If you're looking to enable/disable, use hcnage and .toggle() in addition to the above, like this: $("table").delegate("input.chk", "change", function(){ $(this).closest('tr').find(".disabled").toggle(this.checked); });
转载地址:https://blog.csdn.net/horace_lee/article/details/83924438 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
关注你微信了!
[***.104.42.241]2024年04月03日 11时06分33秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
自己造个简单数据校验的注解@Value和@Mail
2019-04-26
Poj百练 4148:生理周期 (分类:枚举)
2019-04-26
Java如何读写注册表
2019-04-26
java如何利用模板文件生成word文档
2019-04-26
java读写xlsx格式的MS Excel文件
2019-04-26
vue的一些基础知识点
2019-04-26
webpack错误记录(不定期更新)
2019-04-26
Poj百练 2692:假币问题 (分类:模拟)
2019-04-26
SpringBoot实现一个文件上传服务
2019-04-26
前后分但文件上传与多文件上传,前端实现
2019-04-26
Poj百练 2711:合唱队形 (分类:动态规划)
2019-04-26
SpringBoot自定义banner
2019-04-26
JWT(JSON Web Token)认证小结
2019-04-26
Poj百练 2746:约瑟夫问题 (分类:模拟)
2019-04-26
git知识点梳理
2021-06-29
git中tag标签的用法
2021-06-29
VTK:文字来源TextOrigin
2021-06-29
VTK:XYPlot图
2021-06-29
VTK:检查模块CheckForModule
2021-06-29