首页 咨询中心 IT学堂
网站建设bind方法为每个匹配元素的特定事件绑定事件处理函数

bind方法为每个匹配元素的特定事件绑定事件处理函数。

描述:

当每个段落被点击的时候,弹出其文本。

jQuery 代码:

$("p").bind("click", function(){
 alert( $(this).text() );
});

描述:

同时绑定多个事件类型

jQuery 代码:

$('#foo').bind('mouseenter mouseleave', function() {
 $(this).toggleClass('entered');
});
 

上一篇 js和jque中join()用法以一样都是将数组他隔成一字符串
上一篇 jquery中的sort()方法按字母顺序为字符串数组排序
本方链接: http://www.web258.cn/article/show/i1544.html
ARTICLE 相关推荐