checkbox选中复选框,添加文本框可编辑,不选中,则不可编辑 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="JS/jquery-3.1.0.min.js"></script>
<script type="text/javascript">
$(function(){
var s = $("input:checkbox");
s.each(function(i) {
$(this).click(function(){
if($(this).is(':checked')){
$(this).parent().next().append("<input type='text' />");
}
if(!$(this).is(':checked')){
$(this).parent().next().empty();
}
});
});
})
</script>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>
<input type="checkbox" class="check" />
</td>
<td></td>
</tr>
<tr>
<td><input type="checkbox" class="check"/></td>
<td></td>
</tr>
</table>
</body>
</html>