87,838
社区成员




<div>
<table>
<thead>
<tr>
<th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th>
</tr>
</thead>
<tbody>
<tr id="template">
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
</tr>
</tbody>
</table>
<input type="button" value="增加"/>
<input type="button" value="删除"/>
</div>
<html>
<head>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#b1").click(function(){
$("#template").append("<td><input></input></td>");
});
$("#b2").click(function(){
if($("td").last().index()!=0)
$("td").last().remove();
});
});
</script>
</head>
<body>
<table>
<thead>
<tr>
<th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th>
</tr>
</thead>
<tbody>
<tr id="template">
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
<td><input type="text" style="width:100%"/></td>
</tr>
</tbody>
</table>
<input id="b1" type="button" value="增加"/>
<input id="b2" type="button" value="删除"/>
</body>
</html>
判断一下就行了