查看该问题的代码中的评论:jQuery tr(表行)对象不能被使用两次/多次?
从json对象动态创建的j对象的tr对象不能被使用两次以追加到不同的表中?
function myfunc(obj)
{
//obj is JSON object
jQuery('#ClientInfo').html('');
jQuery('#clientListTable2G').html('');
jQuery.each(obj, function(key, objClient) {
var tr = jQuery('<tr>').append(
jQuery('<td>').text(objClient.hostname),
jQuery('<td>').text(objClient.mac),
jQuery('<td>').text(objClient.rssi),
jQuery('<td>').text("Wifi 2.4G"),
jQuery('<td>').text(objClient.ip)
).appendTo('#ClientInfo');
/* HERE IS THE QUESTION */
//If i uncomment below line than the #ClientInfo becomes blank and the tr row fills in #clientListTable2G only
//jQuery('#clientListTable2G').append(jQuery(tr));
});
}
其中是关闭tr ??? –
我不确定在此语法中是否必须要求结束标记。但如果只附加在一个表中,则工作。 –