我做了一个过滤的列表视图,但是它显示了两个搜索框:
我的代码:
HTML
<div data-role="page" id="searchevents">
<div data-role="header">
<h1>Search</h1>
</div>
<div data-role="content">
<ul id='searchlist' data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="Search by club or event name..."></ul>
</div>
</div>
JS
$( document ).on( "pageinit", "#searchevents", function() {
$( "#searchlist" ).on( "listviewbeforefilter", function ( e, data ) {
var $ul = $( this ),
$input = $( data.input ),
value = $input.val(),
html = "";
$ul.html( "" );
if ( value && value.length > 2 ) {
$ul.html( "<li><div class='ui-loader'><span class='ui-icon ui-icon-loading'></span></div></li>" );
$ul.listview( "refresh" );
$.ajax({
url: "http://gd.geobytes.com/AutoCompleteCity",
dataType: "jsonp",
crossDomain: true,
data: {
q: $input.val()
}
})
.then( function ( response ) {
$.each( response, function ( i, val ) {
html += "<li>" + val + "</li>";
});
$ul.html( html );
$ul.listview( "refresh" );
$ul.trigger( "updatelayout");
});
}
});
});
如果我拿出