title: how to show the jquery confirm dialog on button click?
body: <p>I want to show the jQuery confirm dialog on button click. But, when I load page it doesn't show the confirm box.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    $(document).ready(function(){
          $(document).on("click","#remove",function () {
              let id = $(this).attr("value");
              Dialogify.confirm('Are you sure you want to remove data ?', {
                  ok: function () {
                      Dialogify.alert('deleted');
                      $.ajax({
                          url: "remove_post.php",
                          type: "POST",
                          data: {
                              p_id: id
                          },
                          success: function (data) {
                              Dialogify.alert('deleted');
                              // alert(data);
                          }
                      })
                  },
                  cancel: function () {
                      this.close();
                  }
  
  
              });
  
  
          });
      });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>                &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;HomeShopping&lt;/title&gt;
      &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" &gt;
      &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://www.jqueryscript.net/demo/Dialog-Modal-Dialogify/dist/dialogify.min.js"&gt;&lt;/script&gt;
                  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class="container-fluid"&gt;
      &lt;div class="row px-5"&gt;
          &lt;div class="col-md-7"&gt;
              &lt;div class="shopping-cart"&gt;
                  &lt;h6&gt;My Cart&lt;/h6&gt;
                  &lt;hr&gt;
  
                  &lt;?php
                  include("functions/functions.php");
                  $total = 0;
  
                  $ip_add = getRealIpUser();
  
                  $select_cart = "select * from cart where ip_add='$ip_add'";
  
                  $run_cart = mysqli_query($conn,$select_cart);
  
                  while($row_cart = mysqli_fetch_array($run_cart)){
  
                      $pro_id = $row_cart['p_id'];
  
                      $pro_size = $row_cart['size'];
  
                      $pro_quantity = $row_cart['quantity'];
  
                      $get_products = "select * from products where no='$pro_id'";
  
                      $run_products = mysqli_query($conn,$get_products);
  
                      while($row_products = mysqli_fetch_array($run_products)){
  
                          $product_title = $row_products['product_title'];
  
                          $product_img1 = $row_products['product_img1'];
  
                          $only_price = $row_products['product_price'];
  
  
                          ?&gt;
                          &lt;form  method="post" class="cart-items"&gt;
                              &lt;div class="border rounded"&gt;
                                  &lt;div class="row bg-white"&gt;
                                      &lt;div class="col-md-3 pl-0"&gt;
                                          &lt;img src="product_images/&lt;?php echo $product_img1; ?&gt;" alt="Image1" class="img-fluid"&gt;
                                      &lt;/div&gt;
  
                                      &lt;div class="col-md-6"&gt;
                                          &lt;h5 class="pt-2"&gt;&lt;?php echo $product_title; ?&gt;&lt;/h5&gt;
                                          &lt;small class="text-secondary"&gt;Seller: dailytuition&lt;/small&gt;
                                          &lt;h5 class="pt-2"&gt;&lt;?php echo $only_price; ?&gt;&lt;/h5&gt;
                                          &lt;button type="submit" class="btn btn-warning"&gt;Save for Later&lt;/button&gt;
                                          &lt;button id="remove" type="submit" class="btn btn-danger mx-2" name="remove" value="&lt;?php echo $pro_id;?&gt;"&gt;Remove&lt;/button&gt;
                                      &lt;/div&gt;
  
                                      &lt;div class="col-md-3 py-5"&gt;
                                          &lt;button type="button" class="btn bg-light border rounded-circle" &gt;&lt;i class="fas fa fa-minus" &gt;&lt;/i&gt;&lt;/button&gt;
                                          &lt;input type="text" id="&lt;?php echo $pro_id?&gt;" value="&lt;?php echo $pro_quantity?&gt;" class="form-controls w-25 d-inline"&gt;
                                          &lt;button type="button" class="btn bg-light border rounded-circle" &gt; &lt;i class="fas fa fa-plus" &gt;&lt;/i&gt;&lt;/button&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/form&gt;
  
  
                      &lt;?php }}?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <blockquote>
    <p>remove_post.php</p>
  </blockquote>
  
  <pre><code>    &lt;?php
  include ("conn.php");
  global $conn;
  if(isset($_POST['p_id'])){
  
      if ($stmt = mysqli_prepare($conn, "delete from cart where p_id=?")) {
  
          /* bind parameters for markers */
          mysqli_stmt_bind_param($stmt, "i", $_POST['p_id']);
  
          mysqli_stmt_execute($stmt);
  
      }
  }
  </code></pre>
  
  <blockquote>
    <p>how to show the jquery confirm dialog on button click?
    when I click the remove button it could show a confirm box, but it disappears quickly! I don't know what's the problem.<br/>
    I use the jquery Dialogify library</p>
  </blockquote>