Close modal throws Uncaught TypeError:

I have my close modal function as

const JqueryModalCloseBtn = function () {
    $(document).find('a.close-modal').click(function(){
      $('a.close-modal').modal('hide');
    })
}

I have a page with following tags

<a targetted-modal-id="#List-81" class="preview-button" verification="docs" href="javascript:void(0)">Preview</a>

when I click on Preview my modal opens and when I try to close the modal, it closes but I get Uncaught TypeError: i is null in the console… And If I click on my preview again I get Uncaught TypeError: this.$blocker is null… I have to click twice to open the modal now…

Can someone please help me with this…?

const JqueryModalCloseBtn = function () {
$(document).find(‘a.close-modal’).click(function(){
$(‘.a.close-modal’).modal(‘hide’);
})

One of these things is not like the other~
(Now you’ve got a pointer to your problem AND Sesame Street stuck in your head. Congrats.)

that was typo :see_no_evil: I have edited the question.

Not 100% sure we can find the problem without seeing the whole page/modal…

Why are you not hiding #List-81 if your modal target is that?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.