我试图在页面打开时隐藏一个元素,然后在单击按钮时显示,但它不显示该元素。我希望隐藏 ID 为 extraForm 的表单,直到按下按钮
<!DOCTYPE html>
<head>
<script src="Javascripts/jquery.js"></script>
<script type="text/javascript">
$(function () {
$("#extraForm").hide()
});
$('#showForm').click(function(){
$('#extraForm').show();
});
</script>
<link rel='stylesheet' href='website.css'>
</head>
<body>
<form action="submit.php" method="post">
<table> <table border="1"> <tr>
<tr> <td> First Name: </td> <td> <input type="text" name="firstName"> </td> </tr>
<tr> <td> Last Name: </td> <td> <input type="text" name="lastName"> </td> </tr>
<tr> <td> Dorm Name: </td> <td> <input type="text" name="dormName"> </td> </tr>
<tr> <td> Room Number: </td> <td> <input type="text" name="roomNumber"> </td> </tr>
<tr> <td> Pizza Type: </td> <td> <input type="radio" name="pizzaType" value="Cheese">
Cheese
<input type="radio" name="pizzaType" value="Pepperoni"> Pepperoni <br>
<input type="radio" name="pizzaType" value="Buffalo Chicken"> Buffalo Chicken </td>
<tr> <td> Number of Pizza's: <td> <input type="text" name="pizzaNumber"> </td> </tr>
<tr> <td> </td> <td> <input type="submit"> </tr> </td>
<table> <table border="1" id="extraForm">
<tr> <td> <input type="radio" name="pizzaType" value="Cheese"> Cheese</td> </tr>
<tr> <td> <input type="radio" name="pizzaType" value="Buffalo Chicken"> Buffalo Chicken
</td> </tr>
<tr> <td> <input type="radio" name="pizzaType" value="Pepperoni"> Pepperoni</td> </tr>
<input type="button" name="showForm" value="Add Pizza" id="showForm">
</table>
</table>
</form>
</body>
</html>