jquery的$(this)使用
来源:互联网 发布:java调用so库 编辑:程序博客网 时间:2024/05/16 09:18
一、this和$(this)区别
this通常是一个Html 元素,例如(textbox),textbox有text属性。可以在textbox的事件里面引用this获取元素
$(this)通常是一个JQuery对象 ,
如:
我触发danji_jian()事件获取class为gouwuc_dan 的元素,则 寻找顺序将为this->gouwuc_shu(父节点)->gouwuc_dan (兄弟节点)
$(this).parent(".gouwuc_shu").prevAll(".gouwuc_dan").text();
或者可以先查找祖先元素gouwuc_bod->gouwuc_dan();
$(this).parents(".gouwuc_bod").children(".gouwuc_dan").text();
网上关于-jQuery的父,子,兄弟节点的查找方法常用的有
jQuery.parent(expr) //找父元素
jQuery.parents(expr) //找到所有祖先元素,不限于父元素
jQuery.children(expr) //查找所有子元素,只会找到直接的孩子节点,不会返回所有子孙
jQuery.contents() //查找下面的所有内容,包括节点和文本。
jQuery.prev() //查找上一个兄弟节点,不是所有的兄弟节点
jQuery.prevAll() //查找所有之前的兄弟节点
jQuery.next() //查找下一个兄弟节点,不是所有的兄弟节点
jQuery.nextAll() //查找所有之后的兄弟节点
jQuery.siblings() //查找兄弟节点,不分前后
新手一个,如有错误之处,欢迎指点- jquery的$(this)使用
- jQuery中的$(this)的使用
- 关于jQuery里面的this的使用
- jQuery中 this 关键字的使用小记。
- jquery中this对象的使用
- Jquery this的用法
- Jquery里面的this
- jquery的$(this)理解
- jquery $(this)的解释
- jQuery: 在this的环境中使用选择器
- jquery的this与$(this)的区别
- JavaScript的this 与JQuery的$(this)
- JQuery 中this 和 $(this) 的区别
- JQuery -- this 和 $(this) 的区别
- jQuery中this与$(this)的区别
- JQuery this 和 $(this) 的区别
- jQuery中this与$(this)的区别
- JQuery -- this 和 $(this) 的区别
- sql语句优化
- VS2012+opencv2.4.11安装步骤
- Fusion Middleware Error Messages Reference
- hibernate中hql语句
- dd命令格式化硬盘dd if=/dev/zero of=/dev/raw/raw1 bs=1k count=3000
- jquery的$(this)使用
- 自定义View2
- android 自定义可拖动框
- Leetcode-169-Majority Element
- WINDOWS2008缓存设置工具,解决系统运行久了因系统缓存造成物理内存占用高僵死的问题
- 集合排序问题
- nginx反向代理apache配置
- linux磁盘分区fdisk命令详解
- 自定义View进阶-Canvas之画布操作