我想使用复选框显示和隐藏表格。该表出现和消失没有问题。但是复选框没有被选中。我有 Jquery v1.8.2 。我有以下代码:
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$('#checkbox').toggle(function() {
document.getElementById('table').style.display = "inline";
}, function() {
document.getElementById('table').style.display = "none";
});
</script>
</head>
<body>
<form action="" method="POST" enctype="multipart/form-data">
<input type="checkbox" id="checkbox">
<br />
<table id="table" style="display: none;">
<tr>
<td>
<input type="file" name="file">
<input type="submit" name="upload" value="upload">
</td>
</tr>
</table>
</form>
</body>
</html>