閉じるボタンの簡単な解決策が必要なダイアログがたくさんあります。それぞれを閉じるために大量のコードを書きたくありません。
ダイアログを閉じたいすべてのボタンとリンクに class="btnDone" を使用したいと思います。各ダイアログの各ボタンのインスタンスごとに個別の関数を記述する以外に、これを行う簡単な方法はありますか?
ダイアログ コードの 1 つの例を次に示します。
<script>
// increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 1000;
$(function() {
$( "#forgotPassword" ).dialog({position:['middle',60],
open: function(event, ui) {
jQuery('.ui-dialog-titlebar-close').removeClass("ui-dialog-titlebar-close").html('<span style="float:right;"><img src="../images/x.png" /></span>');
},
dialogClass: 'ui-widget-shadow',
modal: true,
autoOpen: false,
width: '650px',
close: function(ev, ui) {$(this).close();}
});
$( ".forgotPasswordOpen" ).click(function() {
$( "#forgotPassword" ).dialog( "open" );
return false;
});
});
</script>
<div style="display:none">
<div id="forgotPassword">
<!--#include file="modal08.asp"-->
</div>
</div>
class="btnDone" を使用して close 関数を作成するにはどうすればよいですか?