How do I force jQuery append to NOT automatically close a tag?

前端 未结 3 1392
借酒劲吻你
借酒劲吻你 2020-11-30 11:07

I have a JavaScript object with about 1000 properties and want to create a

of these entries, with eight properties in a single row,
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 11:26

    You're thinking in terms of html markup, with using append you should be thinking in terms of html DOM, you don't have open tags and close tag just elements.

    You can use a string to build your html then append it to the table

    var ctr = 0;
    var innerTable = '
'; for (var g in g2u) { innerTable += '\n'; ctr++; if (ctr % 8 == 0) { innerTable += '\n'; } } $("#list").append(innerTable);

提交回复
热议问题
'+g+'\n'; innerTable += ''+g2u[g]+'\n'; innerTable += '