Я пытаюсь создать функцию jQuery, чтобы проверить, была ли нажата кнопка «Отмена» или «Удалить» в диалоговом окне facebox, однако я не совсем уверен, как это сделать.
Сейчас у меня есть:
// Confirm and remove group members
$("[id^='removeGroupMember_']").click(function () {
confirmDialog('Removal', 'Are you sure you want to remove this person from the group?');
// I need to check the results of the confirm dialog prior
// to calling the code below to remove the actual rows
$(this).parent().slideUp("fast", function () {
$(this).remove();
updateGroupRows();
});
return false;
});
Где confirmDialog
:
function confirmDialog(action, message) {
$.facebox('<h3 class="confirmHeader light tb">Confirm ' + action + '</h3><div class="confirmContent"><p>' + message + '</p><a href="#" id="dialogConfirmAction" class="ras small red button right">' + action + '</a><a href="#" id="dialogConfirmCancel" class="ras small gray button right">Cancel</a></div>');
};
Сейчас у меня есть две функции для нажатия этих кнопок, но я не уверен, как проверить их результат иверните это обратно, чтобы я мог решить, удалять ли соответствующую строку:
$('#dialogConfirmAction').live('click', function() {
console.log('Yep... they dun clicked it.');
return true;
});
$('#dialogConfirmCancel').live('click', function() {
$.facebox.close();
return true;
});
Любое руководство, которое вы можете предоставить, будет высоко оценено!