【发布时间】:2014-06-18 14:16:16
【问题描述】:
我需要存储一个 html 对象并再次显示它...我的代码复制它但不显示它..
要求:
我需要复制#test,将其从页面中删除并再次显示。
HTML
<div id="test">
I will be copied, removed and shown again
</div>
jQuery
$( document ).ready(function() {
alert( "ready!" );
var a = $("#test")
$( "#test" ).remove();
a.show()
});
【问题讨论】:
-
我不认为你真的想复制它,对吧?您只想将其保存到变量中并将其从文档中删除,然后将其放回文档中,对吗?我没有看到您试图将其放回文档的哪个位置。