From eaf93ff1dcd4e3afecf8d812d3c8ef97cfae7e02 Mon Sep 17 00:00:00 2001 From: Don Date: Sun, 3 Oct 2021 12:10:24 -0500 Subject: [PATCH] Remove manually loaded modal from DOM when closed, #301 --- jquery.modal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jquery.modal.js b/jquery.modal.js index 7e62a4d..f873030 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -74,7 +74,8 @@ } else { this.$elm = el; this.anchor = el; - this.$body.append(this.$elm); + remove = function(event, modal) { modal.elm.remove(); }; + this.$body.append(this.$elm).on($.modal.CLOSE, remove); this.open(); } };