Modal Form Close Button Not working

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Modal Form Close Button Not working

Post by adam »

Hi anyone,

with the following jQuery my modal form opens from the custom datable button.

Code: Select all

dom: 'Bfrtip',
        buttons: [
              {
              text: 'New Item',
              action: function ( e, dt, node, config ) {
              home()
              
    }
      },

Code: Select all

function home(){

   $('#myModal').modal('show')
   
  }
However the close button does not work.

But if I open the modal form from the following button

Code: Select all

<button type='button' class='btn bd-yellow-500'data-toggle='modal' data-target='#myModal'><i class="fas fa-user-plus"></i> New Item</button>
the close button works.

follwing is the code for the close button

Code: Select all

          <!-- Modal Header -->
          <div class="modal-header">
            <h2>Item Details</h2>
            <button type="button" id="btn-close" class="close" data-dismiss="modal" onclick="clearForm();">&times;</button>
          </div>
What am I missing here? Any help would be kindly appreciated.
Best Regards,
Adam