jQuery的delegate()与proxy()方法
2015-10-03 01:07
851 查看
1.
jQuery 事件 - delegate() 方法
定义和用法
delegate() 方法为指定的元素(属于被选元素的子元素)添加一个或多个事件处理程序,并规定当这些事件发生时运行的函数。
使用 delegate() 方法的事件处理程序适用于当前或未来的元素(比如由脚本创建的新元素)。
www.w3school.com.cn/jquery/event_delegate.asp
2.
The $.proxy method takes an existing function and returns a new one with a particular context.
This method is often used for attaching events to an element where the context is pointing back to a different object.
Tip: If you bind the function returned from $.proxy, jQuery will still unbind the correct function if passed the original.
http://www.w3schools.com/jquery/event_proxy.asp
----
jQuery 事件 - delegate() 方法
定义和用法
delegate() 方法为指定的元素(属于被选元素的子元素)添加一个或多个事件处理程序,并规定当这些事件发生时运行的函数。
使用 delegate() 方法的事件处理程序适用于当前或未来的元素(比如由脚本创建的新元素)。
$("div").delegate("button","click",function(){ $("p").slideToggle(); });
www.w3school.com.cn/jquery/event_delegate.asp
2.
The $.proxy method takes an existing function and returns a new one with a particular context.
This method is often used for attaching events to an element where the context is pointing back to a different object.
Tip: If you bind the function returned from $.proxy, jQuery will still unbind the correct function if passed the original.
http://www.w3schools.com/jquery/event_proxy.asp
----
this.$el.delegate('tbody tr', 'click', $.proxy(this._clickRow, this));
相关文章推荐
- jQuery 源码callbacks
- jquery td 点击改变颜色
- jQuery 缺点
- jquery 获取元素内容和值
- jQuery 事件的命名空间
- 用jquery实现全选功能
- 用jquery实现全选/全部选功能(jquery-1.9.x 版本以上),使用 prop 属性
- jquery于form正在使用submit问题,未解决
- jQuery获取页面及个元素高度、宽度
- Jquery中Ajax的几种用法
- jquery常用选择器(下)
- jquery mobile手机自适应问题
- Jquery Validate高级定制: 传入正则表达式,传入错误消息
- JQuery的Ajax()向后台传参方式
- jquery鼠标悬停和离开事件(可用于下拉菜单等)
- jQuery网页右侧广告跟随滚动代码分享
- jQuery+PHP星级评分实现方法
- jQuery+PHP星级评分实现方法
- jQuery网页右侧广告跟随滚动代码分享
- JQueryMobile开发Cordova时多页应用模式