Hide listview item
Description
The following code shows how to hide listview item.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.4.js'></script>
<style type='text/css'>
#no-results {<!--from w ww. ja v a2 s. c om-->
display: none;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(function(){
$(document).ready(function() {
$('#mylist li').addClass('ui-screen-hidden');
$('input[data-type="search"]').keyup(function() {
if ($(this).val() === '') {
$('#mylist li').addClass('ui-screen-hidden');
} else {
$('#mylist li').removeClass('ui-screen-hidden');
}
$(this).trigger('change');
});
});
});//]]>
</script>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="content">
<ul id="mylist" data-role="listview" data-filter="true"
style="display: block">
<li><a href="#">stack</a></li>
<li><a href="#">over</a></li>
<li><a href="#">flow</a></li>
</ul>
</div>
</div>
</body>
</html>