jQuery on()方法使用技巧详解
jQueryon()方法是官方推荐的绑定事件的一个方法。
$(selector).on(event,childSelector,data,function,map)
由此扩展开来的几个以前常见的方法有.
bind()
$("p").bind("click",function(){ alert("Theparagraphwasclicked."); });
$("p").on("click",function(){ alert("Theparagraphwasclicked."); });
delegate()
$("#div1").on("click","p",function(){ $(this).css("background-color","pink"); });
$("#div2").delegate("p","click",function(){ $(this).css("background-color","pink"); });
live()
$("#div1").on("click",function(){ $(this).css("background-color","pink"); });
$("#div2").live("click",function(){ $(this).css("background-color","pink"); });
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短