さて、私は一日中Q & Aを読んだが、やり遂げられなかった。Bootstrap Modal - Yesボタンをクリックした場合Trueを返す方法
<a href="remove.php?id=3" onclick="return custom_confirm('Are you sure you want to remove this?');" />
と私:代わりに、デフォルトのダイアログのユーザーがはいをクリックした場合、私はtrueを返すために、ブートストラップモーダルを使用し、第
例えばfalseを返す式I)は、カスタマイズされた確認を(作成するために必要なカスタムconfirm関数は次のとおりです。
function custom_confirm(message) {
// put message into the body of modal
$('#modal-custom-confirmation').on('show.bs.modal', function (event) {
// store current modal reference
var modal = $(this);
// update modal body help text
modal.find('.modal-body #modal-help-text').text(message);
});
// show modal ringer custom confirmation
$('#modal-custom-confirmation').modal('show');
// if Yes button is clicked, return true
// if No button is clicked, return false
// logic here...
}
私のモーダルはここにある:
<!-- modal: custom confirmation -->
<div class="modal fade text-left" id="modal-custom-confirmation" tabindex="-1" role="dialog" aria-labelledby="modal-help-title">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong class="modal-title" id="modal-help-title">Confirm</strong>
</div><!-- /.modal-header -->
<div class="modal-body">
<p id="modal-help-text"></p>
</div><!-- /.modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-success">Yes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
</div><!-- /.modal-footer -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
同じことは、過去に私に起こった、そして最終的に私はhttp://bootboxjs.com/外のライブラリを使用する必要がありました。 –
@TranAudi、ありがとう!あなたはここに釘付け:http://bootboxjs.com/examples.html#also-applies-to-alert-prompt-customwith-alternate-button-tex –