Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AJAX loaded modal not being removed from DOM on close #301

Open
vanboom opened this issue Oct 3, 2021 · 0 comments
Open

AJAX loaded modal not being removed from DOM on close #301

vanboom opened this issue Oct 3, 2021 · 0 comments

Comments

@vanboom
Copy link

vanboom commented Oct 3, 2021

When modals are opened using <a rel='modal:open'...>, they are removed from the DOM when the modal is closed. This does not happen is the modal is loaded via AJAX per the examples here.

// Open modal in AJAX callback
$('#manual-ajax').click(function(event) {
  event.preventDefault();
  this.blur(); // Manually remove focus from clicked link.
  $.get(this.href, function(html) {
    $(html).appendTo('body').modal();
  });
});

Please consider removing the modal from the DOM when it is closed the same way that it is removed when launched from a hyperlink.

I have fixed this and tested - will submit a PR, but not sure if this project still has active maintainers?

vanboom added a commit to vanboom/jquery-modal that referenced this issue Oct 3, 2021
@vanboom vanboom changed the title AJAX loaded modal not being removed on close AJAX loaded modal not being removed from DOM on close Oct 3, 2021
styletronix added a commit to styletronix/jquery-modal that referenced this issue May 6, 2023
Remove manually loaded modal from DOM when closed, kylefox#301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant