genarate table rows onclick

by Prasanth AR

HTML

<button  id="gen">Generate</button>
	<table id="report" border="1" style="visibility:hidden">
        <thead>
            <tr>
			    <th>Sl.No.</th>
			    <th>District Name</th>
		    </tr>
        </thead>
        <tbody>
            
        </tbody>
	</table>

JavaScript

$("#gen").click(function(){
$("#report").css("visibility","visible");
$("#report").html('<tr><th>Sl.No.</th><th>District Name</th></tr>');
for(var i=0; i<5; i++)
    {
        var row='<tr><td>('+(i+1)+')</td></tr>'
        $("#report").append(row);
    }
});