1
  $(document).ready(function () {
            $("#close").click(function () {
                var link = $(this).attr("href"); // "get" the intended link in a var
                var result = confirm("Are you sure?");
                if (result) {
                    document.location.href = link;  // if result, "set" the document location      
                }
            });
        });

JavaScript ダイアログの代わりに Bootbox ダイアログを使用するにはどうすればよいですか?

編集

試してみましたが、ブートボックスダイアログの[OK]ボタンをクリックしても何も起こりません

        $(document).on("click", "#close", function (e) {
            e.preventDefault();
            var link = $(this).attr("href"); // "get" the intended link in a var
            bootbox.confirm("Are you sure you want to close this Incident? This operation cannot be reversed.", function (result) {
                    if (result) {
                        document.location.href = link;
                    } else {
                        console.log("user declined");
                    }
                });
        });
4

1 に答える 1