Clone Show Append

知乎答案示例 http://www.zhihu.com/question/20143182

HTML

<div id="test" class="test">Here is </div>

CSS

.test{display:none;}
#test{color:#333;}
#clone-1{color:#09c;}
#clone-2{color:#c00;}

JavaScript

$(function(){
    $('#test').clone().appendTo('body') //Clone 元素并附加到页面尾部
        .show().append('clone 1') //显示后附加
        .attr('id', 'clone-1');
    $('#test').clone().appendTo('body')
        .append('clone 2').show() //附加后显示
        .attr('id', 'clone-2');
   $('#test').clone().show();
});