Created
May 13, 2015 15:36
-
-
Save jgonggrijp/1b581f19a79913d94aba to your computer and use it in GitHub Desktop.
parent node error with jQuery Mobile and jQuery.prototype.clone()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a multipage document that includes, among others, a page like the following: | |
<div id="original" data-role="page"> | |
<form class="problematic" onsubmit="diagnostic();"></form> | |
</div> | |
At the bottom of the HTML (end of body) I have a script that clones this page, like this: | |
$('#original').clone().attr('id', 'copy').appendTo(document.body).page(); | |
When I submit the copy of the form in the cloned page, the error is revealed in the submit handler with code like this: | |
function diagnostic(event) { | |
console.log($(event.target).parent()); // prints $('#original') instead of $('#copy') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment