標籤:錯誤 nbsp 分享 div 不同 image app map append
Ajax擷取資料後append追加到表格內出現追加的資料與表格風格不同的錯誤:
$("#courierTable").append("<tr style=‘text-align: center‘> class=‘tab-content‘")$("#courierTable").append("<tr style=‘text-align: center‘> class=‘tab-content‘")$("#courierTable").append("<td style=‘text-align: center‘>"+obj[i].staffId+"</td>")$("#courierTable").append("<td>"+obj[i].name+"</td>")$("#courierTable").append("<td>"+obj[i].comapny+"</td>")$("#courierTable").append("<td>"+obj[i].registerDate+"</td>")$("#courierTable").append("<td>asdads</td>")$("#courierTable").append("</tr>")$("#courierTable").append(content)
出現的格式為:
原因是因為append函數要求必須是閉合的完整的標籤,不能先輸出一個tr,再輸出幾個td最後關閉tr。改正後的如下:
content = "<tr style=‘text-align: center‘> class=‘tab-content‘"+"<td style=‘text-align: center‘>"+obj[i].staffId+"</td>"+"<td>"+obj[i].name+"</td>"+"<td>"+obj[i].comapny+"</td>"+"<td>"+obj[i].registerDate+"</td>"+"<td>asdads</td>"+"</tr>";$("#courierTable").append(content)
效果如下:
Ajax擷取資料後append追加到表格內出現格式混亂的錯誤