{"id":3207,"date":"2014-03-20T02:40:57","date_gmt":"2014-03-20T02:40:57","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/20\/nyromodal-doesnt-close-correctly-collection-of-common-programming-errors\/"},"modified":"2014-03-20T02:40:57","modified_gmt":"2014-03-20T02:40:57","slug":"nyromodal-doesnt-close-correctly-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/20\/nyromodal-doesnt-close-correctly-collection-of-common-programming-errors\/","title":{"rendered":"NyroModal doesn&#39;t close correctly-Collection of common programming errors"},"content":{"rendered":"<p>Here&#8217;s sample a code.<\/p>\n<pre><code>$(\".remove.group\").live(\"click\", function (ev) {\n    var button = $(ev.currentTarget);\n    var action = button.get(0).dataset[\"action\"];\n    var method = button.get(0).dataset[\"method\"];\n    var modal = $(\"#remove\");\n    modal.find(\".primaryaction\").bind(\"click\", function (e) {\n        $.ajax({\n            url: action,\n            type: method,\n            dataType: \"xml\",\n            success: function (rawResponse, status, xhr) {\n               \/\/some business logic\n                $.nmTop().close();\n            },\n            error: function (xhr) {\n                console.log(arguments);\n\n                var message = \"Could not remove group\";\n                alert(message);\n                $.nmTop().close();\n            }\n        });\n    });\n    modal.find(\".cancelButton\").bind(\"click\", function (e) {\n        $.nmTop().close();\n    });\n    $.nmManual(\"#remove\");\n\n    return false;\n});\n<\/code><\/pre>\n<p>I am using nyroModal and jQuery here.<\/p>\n<p>All the click events work fine for the first time. But if I do reopen the modal again and click on either of the buttons nyroModal ends up throwing error:<\/p>\n<blockquote>\n<p>this.elts.cont is undefined<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s sample a code. $(&#8220;.remove.group&#8221;).live(&#8220;click&#8221;, function (ev) { var button = $(ev.currentTarget); var action = button.get(0).dataset[&#8220;action&#8221;]; var method = button.get(0).dataset[&#8220;method&#8221;]; var modal = $(&#8220;#remove&#8221;); modal.find(&#8220;.primaryaction&#8221;).bind(&#8220;click&#8221;, function (e) { $.ajax({ url: action, type: method, dataType: &#8220;xml&#8221;, success: function (rawResponse, status, xhr) { \/\/some business logic $.nmTop().close(); }, error: function (xhr) { console.log(arguments); var message = &#8220;Could [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3207","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3207"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3207\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}