【发布时间】:2023-03-26 21:21:01
【问题描述】:
在我的应用程序中,我有一个 html 按钮,我需要在单击按钮时隐藏 div 中的几个元素,并在再次单击相同按钮时显示相同的元素我可以隐藏 div,但我怎样才能再次显示div elements.Belo 是我的 html 和 jquery 代码
HTML
<button type="button" id="btnsearch" style="background-color: white">Search</button>
<div id="Show"></div>
jQuery
$("#btnsearch").click(function () {
$("#Show").hide();
});
【问题讨论】:
-
为此使用
toggle()