Reputation: 403
When passing the contents of a <div>
to another <div>
with jquery as below, the original is removed.
Is there a way to do this and still retain the original?
Example Here - I want the document to read Item One, Item Two, Item One.
function display() {
$('#display').html($('#ItemOne'));
}
display();
Upvotes: 2
Views: 135
Reputation: 12389
Change to
function open() {
$('#display').html($('#ItemOne').clone());
}
See: jsfiddle
Upvotes: 1
Reputation: 7032
use clone()
function display() {
$('#display').html($('#ItemOne').clone());
}
display();
Upvotes: 4