title: Cannot Close Sweet Alert 2 Modal On Custom HTML Button Click
body: <p>I am having a very hard time for debugging this. I am using custom HTML parameter from <a href="https://sweetalert2.github.io" rel="nofollow noreferrer">SweetAlert2</a>. What I want to achieve is that whenever I click "Back" Button, I want to close the modal. I did read the documentation. we can usee swal.close() or swal.closeModal(). But when I doing it, I can't close the modal upon a back button. Below are the codes.</p>
  
  <pre><code>//declare custom html
          const cancelBtn      = `&lt;button class="cancelSwalBtn" id="standardCancelBtn" &gt;Back&lt;/button&gt;`;
          const removeAddOnBtn = `&lt;button class="removeAddonSwalBtn" id="standardRemoveAddonBtn"&gt;Remove Add-ons&lt;/button&gt;`;
          const proceed        = `&lt;button type="button" role="button" tabindex="0" class="proceedSwalBtn" id="standardProceedBtn"&gt;Proceed&lt;/button&gt;`;
          const html           = `&lt;p&gt;Your voucher does not cover the cost additional of addons. &lt;/p&gt;&lt;div class="btn-holder"&gt;${cancelBtn}${removeAddOnBtn}${proceed}&lt;/div&gt;`;
  
          //custom swal
          swal({
              type: 'info',
              title: 'Info',
              html: `${html}`,
              width :700,
              showCancelButton: false,
              showConfirmButton:false,
              onOpen: (swal) =&gt; {
                  //close btn
                 $(swal).find('#standardCancelBtn').click(function (e) {
                     console.log('in');
                     swal.close();
                     //swal.closeModal();
                 })
              }
  
          }).then((result) =&gt;{
              console.log(result);
          });
  </code></pre>