how to clone content of a div to another div(如何将一个div的内容克隆到另一个div)
问题描述
我想使用 jquery 克隆将选定 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将一个div的内容克隆到另一个div


基础教程推荐
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01