3
我有以下jQuery使用noty插件和梅花购物车jQuery。第一个代码块正确地提醒是/否并正确清空购物车。如何使用jQuery noty插件返回true或false?
第二个代码块显示yes/no消息正确使用noty但它不返回true/false,所以购物车没有清空。
我真的很新的jQuery,所以我可能会错过一些明显的东西!任何帮助,将不胜感激:
//This works..
emptycart: function() {
if (!confirm('Are you sure you want to empty your cart?')) {
return false;
}
},
//This doesnt work..
emptycart: function() {
confirm.call(this, noty({
text: 'Are you sure you want to empty the cart ?',
buttons: [
{type: 'button green', text: 'Ok', click: function() { return false; } },
{type: 'button pink', text: 'Cancel', click: function() { return true; } }
],
closable: false,
timeout: false
}),
true
);
return false;
},
你可以做一个jsfiddle吗? – MCSI 2012-08-27 13:28:34