如何将div的内容克隆到另一个div [英] how to clone content of a div to another div
本文介绍了如何将div的内容克隆到另一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用jquery clone将所选div的内容复制到另一个div. 但我不想将其附加到任何地方
I want to copy the content of a selected div to another div with jquery clone. but I dont want to append it anywhere
我的意思是,当我们使用jquery复制div时(如果我错了,请纠正我),我们必须设置其位置,它会动态创建一个新的除法器.
what I mean is when we make a clone of a div with jquery (correct me if i am wrong) we have to set its position and it will dynamically create a new division which is displayed.
但是我想获取所选div的内容并将其复制到另一个预设div
but I want to get the content of a selected div and copy it to another pre-set div
推荐答案
var a = $('#selector').html();
var b = $('#selector').html(a);
不确定我是否正确理解了您,但我认为那是您的意思:)
not sure I understood you properly but I think thats what you meant :)
这篇关于如何将div的内容克隆到另一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文