为了代码的健壮性,绑定事件之前先解绑再进行绑定。
var _$div = $("#id");_$div.undelegate("click mouseover mouseout dblclick");//先解绑所有的事件_$div.delegate(".sonDiv","mouseover mouseout dblclick",function(e){ var _type = e.type; if(_type == "mouseover"){ }else if(_type == "mouseout"){ }else if(_type == "dblclick"){ }});
_$div.delegate(".finished","click",_case,function(e){ alert(e.data); });
时间: 2024-12-24 00:20:01