Removing elements from a clone
Hi,
I have a block of HTML that I am cloning, as I want to manipulate it to remove an element, so that I can then append that new HTML somewhere else on the page.
E.g.:
- <div id="container">
- <p>Some sample text to be filled in later...</p>
- <a id="copy_btn" href="#">copy text</a>
- </div>
Then in the jQuery, I have tried many different ways of removing stuff from that clone, but with no luck. E.g.
- var cont = $('#container').clone();
- $(cont).remove("copy_btn").appendTo("body");
There are no errors showing up in Firebug, but the html added to the bodu still contains the link with the id "copy_btn".
Is this even possible? The api says that remove() will remove matched selectors from the DOM, so as this is just a set of elements is that the reason? If so, is there a way to achieve this, or would I have to append it somewhere on my page and then perform the manipulation?
Thanks in advance