jQuery 함수를 만들어 페이스 박스 대화 상자에서 취소 또는 제거 버튼을 눌렀는지 확인하려고하는데, 어떻게해야하는지 잘 모르겠습니다. confirmDialog
가 어디jQuery 클릭 선택기를 IF 문으로 전달합니다.
// 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;
});
을 :
는 지금, 나는이
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;
});
제공 할 수있는 모든 지침을 매우 높이 평가합니다!
처음 게시했을 때 오타가 발생했습니다. confirmDialog 함수의 선택기는 취소 버튼입니다. 나는 그것을 고쳤다. –
나는 거대한 맥주 하나를 당신에게 빚지고있다. 본질적으로 콜백 함수를 만들었습니까? 그건 그렇고,'$ (this) .parent() '를 호출하면 원래 목록 항목 대신 모달 상자를 호출한다는 의미이므로 선택자를 캐싱하기 시작했습니다. – iwasrobbed
@iWasRobbed : 네, 기본적으로 제가 한 일입니다. 그리고, 죄송합니다. 하하 그냥 원래 클릭 기능에서 새 기능으로 작업을 복사했습니다. 완전을 기하기 위해 그것을 편집 할 것입니다. ** 수정 ** 고정! –