我想拆散首次点击后,锚,但是当用户点击一个特定的按钮,我想click事件重新绑定到这个锚如何重新绑定绑定后的单击事件?
我写了这个代码
$(document).ready(function(){
$("a.package").click(function(){
//alert('click');
$(this).unbind('click');
// the rest of the code
});
$('#activate').click(function(){
$('a.package').bind('click');
// the rest of the code
});
});
的解除绑定功能如何工作好吧,但绑定功能不起作用,为什么?以及如何使其工作?
这可能是有益的:http://stackoverflow.com/questions/516265/jquery -unbind-event-handlers-to-bind-them-again-later – Kokos
你可能想用jQuery的click来代替bind。 http://api.jquery.com/click/ – mrtsherman