关于jquery的on,bind,delegate
来源:互联网 发布:java根据ip获取城市 编辑:程序博客网 时间:2024/06/05 06:22
事件绑定和委托在js里是相当重要的,jquery主要提供了这几种方法:
$('div p').bind('click',function(){});
如果p有多个,会逐一绑定;性能很低
$('div').delegate('p','click',function){});
利用事件冒泡,将事件绑定在父元素上,但是如果dom很深,冒泡到底部就会很慢
$('div').on('click','p',function(){});
bind和delegate其实是通过on方法实现的,
移除事件:
$('div p').unbind('click', 事件);
$('div').undelegate('p','click', 事件);
$('div').off('click', 'p', 事件)
0 0
- 关于jquery的on,bind,delegate
- jQuery事件:bind、delegate、on的区别
- jQuery事件:bind、delegate、on的区别
- jQuery事件:bind、delegate、on的区别
- jQuery中.bind() .delegate() .on()的区别
- jQuery事件:bind、delegate、on的区别
- 关于jquery的事件委托-bind,live,delegate,on的区别发展
- JQuery五:jQuery中.bind() .live() .delegate() .on()的区别
- jquery的事件委托-bind,live,delegate,on的区别
- jQuery的事件处理方法介绍 - bind(),live(),delegate(),on()
- jQuery的事件处理方法介绍 - bind(),live(),delegate(),on()
- jQuery绑定方法的区别 - .bind() / .live() / .delegate() / .on()
- jquery中bind,live,delegate和on的区别
- jQuery中.bind() .live() .delegate() .on()的区别
- jQuery中.bind() .live() .delegate() .on()的区别
- jQuery -> bind / live / delegate 的终结者 - on
- jQuery中.bind() .live() .delegate() .on()的区别
- jQuery中.bind() .live() .delegate() .on()的区别
- 跨域和跨窗口通信
- css3的Flex布局
- 关于js内存回收机制
- http协议全解
- js排序算法
- 关于jquery的on,bind,delegate
- Node中导入模块require和import
- Node和es6的兼容性
- 【Hadoop & Hbase】大数据存储系统编程_读出写入
- sublime text 如何加入eslint
- hive UDAF详解
- css命名规范和样式规范
- 高精度加法
- 【《Real-Time Rendering 3rd》 提炼总结】(三) 第三章 · GPU渲染管线与可编程着色器 The Graphics Processing Unit