Creating div tag dynamically

Posted by Vishalneeraj-24503 under JavaScript on 1/9/2018 | Points: 10 | Views : 238 | Status : [Member] [MVP] | Replies : 0
Hi All,

I have a queries :-

I have a database table which has rows.
Based on table rows i want to create div tag dynamically.

For Example:- Suppose if there are 20 rows. Then 2 div will be created.
if 25 rows then 3 div will be created on so on...

1st div beside 2nd div.

Below are the js function:-

function LoadData(data)
{
debugger;
//var table = $("#resultTable");
var rows_count = 22;
var rowNum = Math.ceil(parseFloat(rows_count));
var resultHtml = '';
resultHtml += "<table style = \'width:100%;\' border=\'0\' colspan=\'2\' id=\'tbl_unique_sites_title\'>";
for (var i = 0; i < rowNum ; i++) {
resultHtml += '<tr>';
resultHtml += '<td border = 1><input type="name" placeholder="text goes here..."></td>';
resultHtml += '</tr>';
}
}
resultHtml += '</table>';
}

I have written logic but 22 rows are creating.
I want to show 10 records in 1 div and remaining 10 records in 2nd div.

Please help me out.
Many thanks !!!!!




Responses

(No response found.)

Login to post response