jQuery -> bind / live / delegate 的终结者 - on
2020-12-13 04:46
标签:jquery on live bind delegate 最近在学习jQuery,使用得是最新版本的1.11.1。照着书本敲了如下代码,却发现无论如何也跑不起来。 原来 参考API文档,on的用法如下 bind / live / delegate 的终结者 - on,soscw.com" href="http://www.soscw.com/infodetail-184255.html" target="_blank">jQuery -> bind / live / delegate 的终结者 - on,搜素材,soscw.com bind / live / delegate 的终结者 - on,soscw.com" target="_blank">jQuery -> bind / live / delegate 的终结者 - on 标签:jquery on live bind delegate 原文地址:http://blog.csdn.net/feelang/article/details/26089261live
已经废弃掉了,取而代之的是on
,jQuery并打算用on来取代bind,live,delegate
。为元素绑定事件
$( "#dataTable tbody tr" ).on( "click", function() {
alert( $( this ).text() );
});
$( "#dataTable tbody" ).on( "click", "tr", function() {
alert( $( this ).text() );
});
为事件处理函数传递数据
function greet( event ) {
alert( "Hello " + event.data.name );
}
$( "button" ).on( "click", {
name: "Karl"
}, greet );
$( "button" ).on( "click", {
name: "Addy"
}, greet );
文章标题:jQuery -> bind / live / delegate 的终结者 - on
文章链接:http://soscw.com/essay/29967.html