How can I add a Dismiss Button to a Webform Modal Conformation? I added an extra close button to my webform confirmation modal in a Bootstrap 4 theme:
&lt;button class=&quot;btn btn-primary&quot; data-dismiss=&quot;modal&quot; id=&quot;button-close-modal&quot; type=&quot;button&quot;&gt;OK&lt;/button&gt;

Then I added a script to act on that button, but it doesn't seem to do anything:
(function($) {
  Drupal.behaviors.hideModal = {
    attach: function(context, settings) {
        $('#button-close-modal', context).on('click', function(e){
            $('.webform-confirmation-modal', context).modal('hide');
        });
    }  
  };
})(jQuery);

Nothing in the console to give me a clue as to what may be happening. I tried .modal('toggle') and that didn't work either (although at least I could visually see a change).
I also tried $('.ui-dialog-titlebar-close', context).click();, but that didn't work either.
Note: I have the &quot;Webform Bootstrap&quot; module enabled.
Here is how I got it working:
(function($) {
  Drupal.behaviors.hideModal = {
    attach: function(context, settings) {
        $('body', context).on('click', '#button-close-modal', function(e){
            $('.webform-confirmation-modal--content', context).dialog('close');
        });
    }  
  };
})(jQuery);