我正在制作一个简单的表格,完美呈现如下......
echo "<div id='totals'>";
echo "<table class='customers' colspan='20'>";
echo "<tr>";
//echo "<th> Property</th>";
//echo "<th> Address</th>";
echo "<th> Line Item</th>";
echo "<th> Item Description</th>";
echo "<th> Freq</th>";
echo "<th> P1</th>";
echo "<th> P2</th>";
echo "<th> P3</th>";
echo "<th> P4</th>";
echo "<th> P5</th>";
echo "<th> P6</th>";
echo "<th> P7</th>";
echo "<th> P8</th>";
echo "<th> P9</th>";
echo "<th> P10</th>";
echo "<th> P11</th>";
echo "<th> P12</th>";
echo "</tr>";
//print revenue line
echo "<tr>";
echo "<td>";
echo "TOTAL";
echo "</td>";
echo "<td>";
echo "INCOME-ALL";
echo "</td>";
echo "<td>";
echo "</td>";
foreach ($rev_total as $r)
{
echo "<td>";
echo $r;
echo "</td>";
}
echo "</tr>";
//print cost line
echo "<tr>";
echo "<td>";
echo "TOTAL";
echo "</td>";
echo "<td>";
echo "DIRECT COSTS-ALL";
echo "</td>";
echo "<td>";
echo "</td>";
foreach ($cost_total as $c)
{
echo "<td>";
echo $c;
echo "</td>";
}
echo "</tr>";
echo "</table>";
echo "</div>";
我现在想要克隆(j查询)使用以下javascript从数组中提取的表及其内容到相同页面上的div id #add-no repeat divs。
$(document).ready(function(){
$('#totals').clone().appendTo('#add');
});
html位......
echo "<div id='add'></div>";
js似乎拒绝克隆div。我以前多次使用过这个克隆功能。所以我想知道这是否与PHP打印html表的事实有关。如果不是我无法解决为什么这不起作用(表格呈现 - PHP最初打印它 - 没有问题)。它只有clone()位不起作用。