JSFiddle - React, Tailwind, and code Playground

HTML

<form id="deleteAll" method="post" action="{{ path('projets_deleteAll') }}">
 
 <button type="submit" class="btn btn-lg btn-danger" id="bn">
          <i class="fa fa-trash"></i> Supprimer
 </button>
 
     <table>
     <tr>
       <td><input type="checkbox" id="checkAll"/> checkAll</td>
     </tr>
     <tr>
     <td>
        <input type="checkbox" id="d" name="check[]" value="1"/>
     </td>
     </tr>
     <tr><td>
        <input type="checkbox" id="d" name="check[]" value="2"/>
     </td></tr>
     <tr><td>
        <input type="checkbox" id="d" name="check[]" value="3"/>
     </td></tr>
     
     </table>                   
   </form>

JavaScript

$(document).ready(function () {

            $("#checkAll").click(function () {

                var checked_status = this.checked;
                var v=[];

                $("input[name='check[]']").each(function () {

                    this.checked = checked_status;
                   
                    //v = $(this).val();
                    v.push($(this).val());

                 //   $('#bn').trigger('submit', function (e) {

                    if (v.length > 0) {
                        document.querySelector('#bn').onclick = function () {

                                swal({
                                            title: "Are you sure?",
                                            text: "You will not be able to recover this                                                 imaginary file!",
                                            type: "warning",
                                            showCancelButton: true,
                                            confirmButtonColor: '#DD6B55',
                                            confirmButtonText: 'Yes, delete it!',
                                            closeOnConfirm: false
                                        },
                                        function () {
                                            swal("Deleted!", "Your imaginary file has been                                                 deleted!", "success");
                                            e.preventDefault();
                                            actiondesubsitution();
                                        });
                        };

                   // });

                    }
                    else {
                        new SweetAlertDialog(this, SweetAlertDialog.ERROR_TYPE)
                                .setTitleText("Oops...")
                                .setContentText("No selection for deleting !")
                                .show();
                    }


   ...