簡體   English   中英

使用jQuery在按鈕單擊中隱藏/顯示HTML內部表

[英]Hide/Show HTML inner table in button click using jquery

我試過使用jQuery隱藏和顯示html內部表。 我想在頁面加載時隱藏表格,然后單擊搜索按鈕后,表格將顯示值。

但是下面的代碼最初是隱藏的,單擊搜索按鈕后,它會閃爍並再次隱藏。請在這里告知問題出在哪里。

$(document).ready(function() {

 $("#historylist").hide();

$("#historysearch").click(function() {
 $("#historylist").show();
});
// }
});    

<table id="searchTbl" width="800" >
<tr>
<td valign="top">Release No</td>
<td valign="top">
<input type="text" name="releaseNo" value="" style="width:200" />
</td>
<td valign="top"><input type="button" value="Search" onClick="commit()" style="width:80" id="historysearch"/></td>
</tr>
<br /><br />
<table border="1" cellpadding="2" cellspacing="0" id="historylist">
<tr>
<th><font size="-1">Header1</font></th>
<th><font size="-1">Header2</font></th>
<th><font size="-1">Header3</font></th>
<th><font size="-1">Header4</font></th> 
<th><font size="-1">Header5</font></th>


</tr>
</table>
</table>

function commit(){

        document.menu.cmd.value='search';
        document.menu.submit();
    }

你可以試試這個嗎

  function commit(){         
      $("#historylist").toggle();
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM