Jquery HTML(),克隆 [英] Jquery HTML(), clone
本文介绍了Jquery HTML(),克隆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的问题,应该很容易,但需要快点
我想用jquery一个div来把这个div放在另一个div中,但是第一个应该是。
例如:
我有HTML
< ; div class =content>一些文字< / div>
我想把这个内容放在另一个div里面
< div class =test>内容div应该放在这里< / div>
Jquery style:
($($。this));
});
但是之后原始的消失:(但我需要离开它!
您可以帮助我吗?
感谢!!
解决方案
我认为我们可以帮助你:)
你需要克隆原始div:
$(。content)。click(function(){
$(。test)。append($(this)。 clone());
});
HI,
I have a quick question should be easy, but need to make it fast
I want to take with jquery one div and to put this div in another one, but the first one should be. For ex:
I have HTML
<div class="content">Some text</div>
I want to put this content in another div
<div class="test"> content div should be here </div>
Jquery styff :
$(".content").click(function(){
$(".test").html($(this));
});
But after that the original " " disappear :(, but I need to leave it !
Can You help ME ?
Thanks !!
解决方案
I think we can help YOU :)
You'll want to clone the original div:
$(".content").click(function(){
$(".test").append($(this).clone());
});
这篇关于Jquery HTML(),克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文