在下面的 jQuery UI 对话框表单中,如何在“关闭”回调函数中跟踪是否单击了“确定”或“取消”?
$( "#dialog-form" ).dialog( "option", "buttons",
[
{
text: "OK",
click: function() {
// sone action...
$( this ).dialog( "close" );
}
},
{
text: "Cancel",
click: function() {
$( this ).dialog( "close" );
}
}
]
);
$( "#dialog-form" ).dialog({
close: function(event, ui) {
// Track here whether 'OK' or 'Cancel' was clicked...
}
});