【发布时间】:2013-05-08 21:06:00
【问题描述】:
我在我的项目(jQuery Mobile)中实现了一个列表视图,并添加了一个用于搜索的文本框。
但我想首先显示列表视图,并且仅在用户单击按钮进行搜索时才显示列表上的文本框。
这是我的代码:
<a data-role="button" href="#" class="search">Show Search box</a>
<ul data-role="listview" data-filter="true" data-filter-placeholder="Pesquisa Contacto..." data-theme="d" data-divider-theme="d" style="padding:10px 10px 10px 10px;top:10px">
<li>
<a href="index.html">
<h3>jQuery Team</h3>
<p><strong>Boston Conference Planning</strong></p>
<p>In preparation for the upcoming conference in Boston, we need to start gathering a list of sponsors and speakers.</p>
<p class="ui-li-aside"><strong>9:18</strong>AM</p>
</a>
</li>
</ul>
JAVASCRIPT:
$(document).on('pagebeforeshow', '#p33', function () {
$('form.ui-listview-filter').hide();
});
$(document).on('click', '.search', function () {
$('form.ui-listview-filter').show();
});
【问题讨论】:
-
您想隐藏搜索框,直到点击按钮?
-
是的,这就是我尝试做的......
-
我已经在 Ishank 的帮助下更新了代码.. 但说加载页面出错
-
就是这样......它如何与toogle一起工作?
标签: javascript jquery html jquery-mobile