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

If you append it will obviously try to close tags.
Try to put your html in an string than append that string to the dom.

    <script>
    var ctr = 0;
    var html="<tr>";

    for (var g in g2u) {
      html+='<td><span class="rom">'+g+'</span>\n';
      html+='<span class="eh">'+g2u[g]+'</span>\n';
      html+='<span class="rom">&nbsp;&nbsp;</span></td>\n';
      ctr++;
      if (ctr % 8 == 0) {
        html+='</tr><tr>\n';
      }
    }


     $("#list").append(html);

Leave a Comment