繁体   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