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>");     } } 

http://jsfiddle.net/djb78/1/


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -