Firefox不會正確顯示和隱藏我的表格。僅在按鈕上顯示標題按下不行。Firefox不會正確顯示和隱藏我的表格。只顯示標題按鈕不按行
基本上我想要的是當用戶點擊按鈕時,顯示ID爲「HideMe」的列標題和相同ID的行。這工作完全在Chrome,但不能在Firefox
<html>
<head>
<title>Show and Hide Javascript won't work in Firefox</title>
<style>
#HideMe {
display:none;
}
</style>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script>
jQuery(document).ready(function ($) {
$('.ShowPassword').click(function() {
$(HideMe).show();
});
});
</script>
</head>
<body>
<table>
<tr>
<th>ID Number</th>
<th>First Name</th>
<th>Middle Name</th>
<th id="HideMe">Password</th>
</tr>
<tr>
<td>2121</td>
<td>Mike</td>
<td>Daniel</td>
<td id="HideMe">Password</td>
</tr>
<button class="ShowPassword">Show Password</button>
</body>
使用相同的ID使用DOM元素不是一個好習慣,您應該爲此使用類。 – bandi 2013-03-08 14:52:24
我試過,但仍然不會在Firefox上顯示隱藏的顯示按鈕按 – user2148427 2013-03-08 15:03:09