jQuery的bind()的三种使用方式事件监听
2016-06-08 10:50
393 查看
bind的三种使用方法
1:直接的加方法名和 函数(可以是匿名函数也可以是一般函数)
2:一次性的添加多个事件名,使用同一个处理函数
3:添加对个函数,每个函数一个处理函数。
</pre><pre name="code" class="html">移除事件监听 可以直接加事件名
</pre><pre name="code" class="html">
</pre><pre name="code" class="html"><!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script src="js/jquery.js"> </script> </head> <body> <input type="button" value="按钮" /> </body> <script type="text/javascript"> alert($("input[value=按钮]")[0].value) $("input[value=按钮]").bind('click',function(){ alert("fujichao") }) // $('input').bind('mouseover mouseout',function(){ // alert("fuji") // }) // $('input').bind({ // mouseover:function(){ // alert('fu') // }, // mouseout:function(){ // alert('2') // } // }) $('input').bind('click',function(){ alert("fuji ") }) $('input').bind({ })
<span style="white-space:pre"> </span><p style="margin-top: 0px; margin-bottom: 0px; font-size: 15px; line-height: normal; font-family: Consolas; color: rgb(6, 6, 6);"><span style="white-space:pre"> </span>$(<span style="color: #289c97">'input'</span>).unbind()</p> </script> </html>
相关文章推荐
- Jquery揭秘系列:ajax原生js实现详解(推荐)
- jquery flot
- jquery flot图表插件
- jquery原理的简单分析,扒开jquery的小外套
- jquery jsonp跨域请求
- jQuery.Uploadify插件实现带进度条的批量上传功能
- 全面解析jQuery $(document).ready()和JavaScript onload事件
- jQuery提示插件qTip2用法分析(支持ajax及多种样式)
- 漂亮实用的jQuery倒计时插件特效代码
- 解决jquery $符号的冲突
- jQuery购物车插件jsorder用法(支持后台处理程序直接转换成DataTable处理)
- jQuery中的事件绑定bind(), live(), on(), delegate()
- jQuery 学习总结
- jQuery Ajax和getJSON获取后台普通json数据和层级json数据用法分析
- jQuery封装的屏幕居中提示信息代码
- jquery 上传空间uploadify使用笔记
- jquery实现的类似百度搜索的输入框自动完成功能
- Jquery中的has、find、filter方法区别
- jquery中的live、on、onclick、bind
- JQuery的部分巧用法