JSFiddle - React, Tailwind, and code Playground
HTML
<table id="maintable" border=1></table>
<button>hi</button>
JavaScript
max = 2
count=0;
$("button").click(function() {
var content='';
content='<div class="inline" id="txtTarget"><table id="abc" class="table1" cellpadding="2" name="xyz" cellspacing="5" border="0" width="100%">'+
'<tr><td valign="top" width="7%"><img src="bullet-grey_01.png" height="10" width="10"> '+
'<span class="question">patients understands the sign and symptoms</span>: <span class="answer">yes</span>'+
'</td></tr> <tr><td valign="top" width="7%"><img src="bullet-grey_01.png" height="10" width="10"> <span class="question">Date of last PCP visit</span>: '+
'<span class="answer">01/01/2014</span> </td></tr></table></div>';
var tr = $("#maintable tbody tr:first");
if(!tr.length || tr.find("td:first").length >= max)
{
$("#maintable").append("<tr>");
}
if(count==0)
$("#maintable tr:last").append("<td>hi"+content+"</td>");
else
$("#maintable tbody tr:first").append("<td>hi"+content+"</td>");
count++;
});