Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Append to table body

< html>   <head>     <script type='text/javascript' src='js/jquery-1.3.2.js'></script>     <script type='text/javascript'> $(document).ready(   function() {     $('table tbody').append(       "<tr>\n" +       "  <td>D</td>\n" +       "  <td>1999</td>\n" +       "</tr>\n"     );   } );     </script>     <style type='text/css'> table {     width: 100%;     background: lightgreen; } th {     background: green;     color: lightgreen; }     </style>   </head>   <body>      <table>        <thead>          <tr>            <th>Title</th>            <th>Year</th>                  </tr>        </thead>        <tbody>          <tr>            <td>R</td>            <td>1975</td>          </tr>        </tbody>      </table>   </body> </html>