在jquery中bing事件是append而不是replace绑定一次执行一次。当bind多次点击事件时点击一次会把以前把的多次多次都会触发所有有unbind想只触发当前bind的事件在bind的之前unbind之前bind的事件。
事例:
$("#moresmall").unbind('click');
$("#moresmall").unbind('click');
$("#moresmall").click(function () {
SilderSetValue(-20);
});
$("#morebig").click(function () {
SilderSetValue(20);
});
live('',function)live是为某个标签添加事件,当在页面上再次添加该标签时为该标签自动添加一个事件。
例如:<div id='divTest'></div>
$('#divTest').live('click',function(){}).当页面上再次出现<div id='divTest'></div>就会有click事件