Jquery:将内容从表复制到分区

Jquery:Copyting content from table to div

本文关键字:复制 分区 Jquery      更新时间:2023-09-26

试图将表的内容复制到div中,但无法使其工作。。。

这是表格和div 的示例代码

<table><tr>
    <td class="movr">See this content</td>
</tr></table>
<div class="sample"></div>

这是jquery代码

$(document).ready(function(){
var move = $(".movr").html;
$(".sample").html(move);
});

找不到错误。。

html是方法而不是属性。使用.html()而不是.html:

var move = $(".movr").html();

$(".movr")返回一个数组NOT对象,mate。