首页javascriptcelljQuery Table - 如何将表单元格添加到表

jQuery Table - 如何将表单元格添加到表

我们想知道如何将表单元格添加到表。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.6.2.js'></script>
<style type='text/css'>
.someclass {
  background-color: #f00;
  padding: 5px;
}
</style>
<script type='text/javascript'>
$(function(){
    $('#myid tbody tr').append('<td class="someclass">stuff...</td>');
});
</script>
</head>
<body>
  <table id="myid">
    <tbody>
      <tr>
        <td>Adjacent to added TD</td>
      </tr>
    </tbody>
  </table>
</body>
</html>