to add a new column append a TD to each TR (or change the colspan of a
TD in each row you didn't modify).

you were doing this

<tr><td id="col"><td></td></td></tr>

when you probably want to be doing something like...

<tr id="row_1"><td class="col"></td><td class="col"></td></tr>

$('tr#row_1').append('<td class="col">second</td>');

On Apr 8, 5:33 am, skunkwerk <skunkw...@gmail.com> wrote:
> Hi,
>    i'm trying to make a really basic 'tab bar' for a project.  i
> looked at the stuff out there (ui tabs, and flytabs) but wanted
> something simpler.  i basically need to create a bunch of horizontal
> cells that can be added to, and don't need any div-switching or
> anything for the content (just links).
>
> i decided a single table with a row would work, and tried to figure
> out how to add new columns/cells to the table.  i tried:
>
> <script>
> function create_table()
> {
>         $('#test').append('<table border=\'1\'><tr><td id=\'col\'>test</td></
> tr></table>');}
>
> function add()
> {
>         $('#col').append('<td>second</td>');}
>
> </script>
>
> ....
> <div id="test"></div>
>
> it seems to sort-of work: the table is added on-the-fly correctly, but
> when i try to add a column, it adds it to the same cell, or so it
> seems.  and the 'col' append is going to break... what's the best way
> to add a new column to the table?
>
> thanks!

Reply via email to