How to match different columns of table in html? -
i have table structure below:
<table> <tr id="tr1"> <td></td> <td></td> </tr> <tr id="tr2"> <td></td> <td></td> <td></td> <td></td> </tr> <tr id="tr3"> <td></td> <td></td> </tr> </table>
now has 2 columns each in first , last row . , 4 columns in 2nd row. if want add 1 more column last row correspondent 4th column in 2nd row , knw should append 1 empty td last row , add column. empty td joining not possible in cases . how add columns randomly , manage structure of table?? can help??
is want?
$(document).ready(function(){ addcol("tr3", 4); }); function addcol(rowid, coldes){ var tr = $("#" + rowid + " td"); var trctr = tr.length; troffset = coldes - trctr; alert(troffset); for(var = 1; <= troffset; i++){ tr.parent().append("<td></td>"); } }
Comments
Post a Comment