jQuery Mobile data-filter, in case of no result

前端 未结 3 1259
时光取名叫无心
时光取名叫无心 2021-02-09 14:51

I\'m currently exploring jQuery Mobile to develop a mobile version of a dashboard with ordertracking information. And what the plan is, is to use a simple unordered list with al

3条回答
  •  渐次进展
    2021-02-09 15:44

    Thank you

    I'm using this code with an extension. I don't want to write each time this #no-result li.

    $(document).delegate('[data-role="page"]', 'pageinit', function() {
    
    var $listview = $(this).find('[data-role="listview"]');
    $listview.append('');
    $listview.listview('refresh');
    $(this).delegate('input[data-type="search"]', 'keyup', function() {
        if ($listview.children(':visible').not('#no-results').length === 0) {
            $('#no-results').fadeIn(500);
        } else {
            $('#no-results').fadeOut(250);
        }
    });
    });
    

提交回复
热议问题