icy
icy

Reputation: 1446

jquery mobile searchable data hidden

http://jquerymobile.com/test/docs/lists/lists-search.html

I want to create a filter like this with jquery mobile without having to view the data but only display the result of the filter

Upvotes: 1

Views: 1641

Answers (1)

Lian
Lian

Reputation: 2357

EDIT: finally I got this code for you.

jQuery:

$(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');
    });

});​

Link: http://jsfiddle.net/6Vu4r/206/

Upvotes: 3

Related Questions