diff --git a/jquery.popupoverlay.js b/jquery.popupoverlay.js
index <HASH>..<HASH> 100644
--- a/jquery.popupoverlay.js
+++ b/jquery.popupoverlay.js
@@ -663,8 +663,7 @@
             }

 

             // Click outside of popup

-            if ($(el).data('popupoptions').blur && !$(event.target).closest('#' + elementId).length && event.which !== 2) {

-

+            if ($(el).data('popupoptions').blur && !$(event.target).closest('#' + elementId).length && event.which !== 2 && $(event.target).is(':visible')) {

                 methods.hide(el);

 

                 if ($(el).data('popupoptions').type === 'overlay') {
Prevent popup from closing unintentionally if it's HTML is modified.

Make sure that the popup doesn't close (with "blur" option set to true) when clicked inside of it, if HTML of the popup is dynamically replaced.

E.g.
$(document).on('click', '#basic #some_button', function(event) {
    $('#basic').html('test');
});