PDA

View Full Version : JS Another neat jQuery trick ...



Wilhelm Murdoch
October 1st, 2008, 03:14 AM
I wrote an article about it (http://www.thedrunkenepic.com/home/articles/jquery-add-another-row-to-a-table/). But, here's a quick rundown if you don't wanna read it.

If you want to add another to to a certain table, just use the following snippet:


var table = '#my-table';

$(table).append($(table + ' tr:last').clone());

Basically, it copies the last row of the specified table and then appends itself before the closing 'table' element.

Neato!