我試圖隱藏一個元素,當頁面打開,然後顯示一個按鈕被點擊,但它沒有顯示該元素。我想用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>
嗯......你錯過了一個開始''標籤... – ahren