Inserting a row into an empty table?

Inserting a row into an empty table?

 Hi,


I have a need to use jquery to insert a row into a table (individual cells within row include images, input box, radio buttons; each with their own attributes). So far i've only been able to append rows to existing rows, or clone an existing row. Is it possible to insert a new row? The table html is already present. I have searched high and low for examples of this to no avail.

Here is what the empty table looks like:


  1. <!-- sub table for answer options -->
  2.             <table id="white_background"  cellpadding="0" border="0">
  3.             <tr><td>
  4.             <table id="answer_options" cellspacing="1" cellpadding="3" border="0">
  5.             <thead>
  6.             <tr >
  7.                 <th class="style3" >Select</th>
  8.                 <th class="style3" colspan="3">Display<br />Order</th>
  9.                 <th class="style3" style="text-align:left">Choice Text</th>
  10.                 <th class="style3" style="text-align:center">Default Selection</th>
  11.                 <th class="style3" style="text-align:center">Edit Answer<br />Text/Options</th>
  12.                 <th class="style3" style="text-align:center">Delete</th>
  13.             </tr>
  14.             </thead>
  15.             <tbody id="container">
  16.             </tbody>
  17.             </table>
  18.             </td></tr>
  19.             </table>


This is the row that needs to be inserted into the empty tbody. It will be inserted each time a user clicks on a "add row" link.

           

  1. <tr class="cell">
  2.             <td style="text-align: center">
  3.             <input class="formbuttons" type="checkbox" name="selected"/>
  4.             </td>
  5.             <td style="text-align: center">
  6.             <img class="up" alt="" src="img/icon_sortup.gif"/>
  7.             </td>
  8.             <td style="text-align: center">1</td>
  9.             <td style="text-align: center">
  10.             <img class="down" alt="" src="img/icon_sortdown.gif"/>
  11.             </td>
  12.             <td>
  13.             <input class="formbuttons" type="text" name="choicetext" size="40" maxlength="1024"/>
  14.             </td>
  15.             <td style="text-align: center">
  16.             <input id="defaultval" class="formbuttons" type="radio" value="1" name="defaultyn"/>
  17.             </td>
  18.             <td style="text-align: center">
  19.             <p>
  20.             <a name="modal" href="#dialog">Edit</a>
  21.             </p>
  22.             </td>
  23.             <td align="center"><img width="10px" height="10px" class="delete" src="img/del.png" /></td>

  24.             </tr>