열린 dialog
상자를 모두 닫으려면 jQuery
을 입력하십시오. 상황은 다음과 같습니다. 대화가없는 간단한 페이지가 있습니다. 대화 상자를 소유하고있는 일부 버튼이 있습니다.열려있는 모든 대화 상자를 닫으시겠습니까? (JQuery)
버튼을 클릭하면 열린 대화 상자를 모두 닫아야합니다. JQuery와
<div id="buttons">
<a href="#" id="btn_1">Button 1</a>
<a href="#" id="btn_2">Button 2</a>
<a href="#" id="btn_3">Button 3</a>
</div>
<div id="dialog_1" class="dialogbox">...</div>
<div id="dialog_2" class="dialogbox">...</div>
<div id="dialog_3" class="dialogbox">...</div>
그리고 여기에 있습니다 : : 여기
는 HTML입니다$(function() {
$('#buttons').find('a').click(function() {
// close all dialogs
$('.dialogbox').dialog("close");
// find out clicked id and open dialog
var nr = this.id.split("_")[1];
$('#dialog_'+nr).dialog();
});
});
크롬 말 : Uncaught Error: cannot call methods on dialog prior initialization; attempted to call method 'close'
.
$('.dialogbox').dialog('isOpen')
을 확인하려고했지만 동일한 결과가 나타납니다.
대화 상자를 어떻게 닫을 수 있습니까? 그에 의해 그렇게 선택, 모두가 .ui-dialog-content
클래스를 가지고 당신은 간단하게이 시도 할 수
$(".ui-dialog-content").dialog("close");
당신은 먼저 대화 상자를 초기화해야 준비 (함수() {. $ ('. 대화 상자') 대화 상자 ({})}) –