标签:ready body mouseover 元素事件 学习笔记 yellow 点击事件 one on()
$(‘p‘).on(‘click‘,function(){ //code here ... });
$(document父).on(‘click‘,‘p子‘,function(){ //code here... })
$(document).ready(function(){ $("p").on({ mouseover:function(){$(this).css("background-color","lightgray");}, mouseout:function(){$(this).css("background-color","lightblue");}, click:function(){$(this).css("background-color","yellow");} }); });
$( "p" ).off();
$( "p" ).off( "click", "**" );
$( "body" ).off( "click", "p", foo );
$(document).off(".someclass");
$( "#foo" ).one( "click", function() { alert( "This will be displayed only once." ); });
$("#foo").on("click", function(event){ alert("This will be displayed only once."); $(this).off(event); });
标签:ready body mouseover 元素事件 学习笔记 yellow 点击事件 one on()
原文地址:http://www.cnblogs.com/liguangsunls/p/6806647.html