mardi 20 septembre 2016

Add ok functionality of alert box to a pop-up checkbox

I am trying to apply the same functionality of Alert box to a checkbox of pop-up code:

        <script>
            $(document).ready(function(){
                $('.pre-sale-product').on('click', function(){
                    $('.productcart').addClass('pre-sale-item-included');
                });
                $('.productcart').on('click', function(){
                    if($(this).hasClass('pre-sale-item-included')){
                        $('#myModal_product').modal('show');
                    }
                });
            })
    </script>
            <div class="modal fade" id="myModal_product" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Important Notice!</h4>
      </div>
      <div class="modal-body">
        <p>Will ship you<?php echo $new_date?>. </p>
      </div>
      <div class="modal-footer">
        <label class="checkbox-inline"><input type="checkbox" value="">Yes, Continue with the same order</label>
      </div>
    </div>
  </div>
</div>

Here when I created alert before the pop-up and I clicked ok It would add product in the cart but now I want a user to click the checkbox and the product is added to the cart automatically.. I know I have to add a function on.checkbox.click but I am not able to figure it out how to call ok function...




Aucun commentaire:

Enregistrer un commentaire