When passing the contents of a <div>
to another <div>
with jquery as b开发者_如何学运维elow, the original is removed.
Is there a way to do this and still retain the original?
function display() {
$('#display').html($('#ItemOne'));
}
display();
use clone()
http://docs.jquery.com/Clone
function display() {
$('#display').html($('#ItemOne').clone());
}
display();
$('#display').html($('#ItemOne').html());
add .html()
Change to
function open() {
$('#display').html($('#ItemOne').clone());
}
See: jsfiddle
精彩评论