3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Laravelで削除するとき、確認アラートを出す方法。(Fromファサード使用時も可能)

Posted at

結論:

inputタグの中にonclick属性でアラート画面を出すようにする

<input type="submit" value="ボタンに入れたい文字" onclick='return confirm("本当に削除しますか?")'>

Formファサードを使用するときは

{{ Form::submit('ボタンに入れたい文字', ['onclick' => 'return confirm("本当に削除しますか?")']) }}

{{ }} で囲んでいるのはblade.phpでPHPを使用するため

参考

https://kekaku.addisteria.com/wp/20200906203037#toc6

https://laraweb.net/practice/7965/

備忘録ブログに続き書いてます

3
4
0

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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?