我在我的项目(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();
});