Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confirmation box using jquery

Tags:

jquery

i want to make a confirmation before delete some data so how can i make it using jquery?

like image 451
enthusiastic Avatar asked May 19 '26 23:05

enthusiastic


2 Answers

$('#deleteBtn').click(function() {
  if(confirm("Are you sure?")) {
    //delete here
  }
});
like image 147
Barrie Reader Avatar answered May 22 '26 03:05

Barrie Reader


One possibility is to use the javascript confirm function.

$(function() {
    $('#someLink').click(function() {
        return confirm('Are you sure you want to delete this item?');
    });
});
like image 29
Darin Dimitrov Avatar answered May 22 '26 03:05

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!