Filter Listview Not Showing Up Properly
I made a filtered listview, however it shows two search boxes:
My Code:
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");
});
}
});
});
If I take out the
from the HTML code (above), both search boxes go away, so I know it is
coming from the same one line source. How do I fix this?
No comments:
Post a Comment