LoginSignup
1
0

【JavaScript】確認メッセージを表示

Posted at

完全honaki用
悪しからず

app.blade.php
<form action="{{ route('admin.destroy', ['id' => $user['id']]) }}" method="post">
  @csrf
  // ⭐️↓これ
  <button id="delete" class="btn btn-danger" onClick="return checkDelete()">削除</button>

  <script>
      // ⭐️↓これ
      function checkDelete(){
          var result = confirm('削除しますか?');
          if(result == true){
              return true;
          }else{
              return false;
          }
      }
  </script>

参考ページ
https://alterbo.jp/blog/riri-210405/

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0