亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel 8 上的 sweetalert 2 上未出現取消

Laravel 8 上的 sweetalert 2 上未出現取消

慕妹3146593 2023-08-24 15:55:12
如果用戶想要提交批準,我希望彈出警報。然而,當在sweetalert上點擊“提交”時,它只顯示“正?!?,沒有取消選項。如何讓取消選項出現?這是我的刀片腳本:<form action="{{ route('Upload') }}" method="POST" enctype="multipart/form-data" id="form" class="formsubmit">                                              @csrf                                              <div class="form-group">                                                  <label for="title">Title:</label>                                                  <input type="text" class="form-control @error('title') is-invalid @enderror" id="title" placeholder="Enter Title" name="title" >                                                  <!-- <span class="text-danger error-text judul_err"></span> -->                                                  @error('title')                                                    <div class="alert alert-danger mt-2">                                                        {{ $message }}                                                    </div>                                                @enderror                                              </div>                                              <!-- <div class="form-group">                                                        <b>Images</b><br/>                                                        <input type="file" name="file">                                                    </div> -->                                            <div class="custom-file">                                                <input type="file" class="custom-file-input @error('file') is-invalid @enderror" name="file">                                                <label class="custom-file-label" for="file">Pilih Berkas Maks. 2 MB</label>                                                @error('file')                                                    <div class="alert alert-danger mt-2">                                                        {{ $message }}
查看完整描述

1 回答

?
ITMISS

TA貢獻1871條經驗 獲得超8個贊

我假設您使用的是最新版本的 Sweet Alert,因為您使用的是最新的 Laravel。如果是這種情況,您需要將 javascript 更新為最新的 SweetAlert 方法。


這已經過測試并可與最新版本的 jQuery 和 SweetAlert 配合使用。


<!-- jQuery -->

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>


<!-- sweetalert -->

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

$( document ).ready(function() {

    $('#form').submit(function (e) {

        e.preventDefault();

        swal({

            icon: "warning",

            title: "Are you sure?",

            text: "Do you want to submit and pay 10 Rupiah",

            buttons: ["No, cancel pls!", "Yes, send it!"],

        })

        .then((value) => {

            console.log('form submitted');

        });

    });

});


查看完整回答
反對 回復 2023-08-24
  • 1 回答
  • 0 關注
  • 176 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號