0
我想要一个确认框添加到该代码:加入jConfrim休息功能
$('.widget .remove').live('click', function() { //Remove widget from layout
$(this).closest('.widget').fadeOut('fast', function() {
$(this).remove();
saveLayout(false);
});
return false;
});
这是我做过什么:
$('.widget .remove').live('click', function() { //Remove widget from layout
jConfirm('Are you sure you want to remove this widget?','Are you sure?',function(r){
if(r)
{
$(this).closest('.widget').fadeOut('fast', function() {
$(this).remove();
saveLayout(false);
});
return false;
}
});
});
在我开始用它碴,清除功能工作很好,现在它什么都不做。我知道if(r)正在执行,因为我在测试时会在代码中放置测试警报(“消息”)。我不知道jquery(或者java脚本)知道哪里出了问题。帮帮我?
我不熟悉jConfirm,但也许$(这)不是处理器的同里。尝试用$('。widget .remove') – Adam 2010-08-06 17:19:32
代替$(this)一个英勇的努力,但它没有奏效。 – 2010-08-06 17:30:54