success: function (data, status) {
var header = $("#MainDiv");
header.html(null);
var headertemplate = $("<table class='searchlistbody'><tr></th><th>Name</th></tr>");
header.append(headertemplate);
$.each(data, function() {
var template = $("<tr> <td class='campnameAltrow'><span class='searchListTitle'></span></td></tr>");
template.find('span.searchListTitle').attr('title', this.Title);
// add the template to the collection
header.append(template);
});
header.append("</table>");
},
現在,當我嘗試在表格上設置邊框時,我發現它只在第n個標籤上應用邊框,即標題(名稱)。動態表格行在DOM中的顯示順序不正確
Debugging further in fire bug I saw that the DOM sequence is in this format
<table class='searchlistbody'><tr><th>Name</th></tr></table>
<tr> <td class='campnameAltrow'>Test</td></tr>
<tr> <td class='campnameAltrow'>Test</td></tr>
<tr> <td class='campnameAltrow'>Test</td></tr>
<tr> <td class='campnameAltrow'>Test</td></tr>
<tr> <td class='campnameAltrow'>Test</td></tr>
誰能告訴我爲什麼是附加所有for循環行....面前的桌子關閉其AJAX調用
謝謝,確實幫助... – Scorpio
操縱DOM有非常不一致的行爲,,,,請你指點我一些好的文章或任何書籍,可以幫助我學習更好.... @Musa – Scorpio