Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile Filtering

jQuery Mobile Filtering


Filterable elements

All elements can be filterable if they have one or more child elements.

How to create a search field:

Next we create a filterable list:

Search elements in a list

 

Try it »

Tip: You can use the placeholder attribute in the search field to set a hint message:

Example

placeholder="Search by name.."

Try it »


Custom filtering

Normally the text inserted into each list item is used as the filter text (e.g. A corresponds to "Adele" or "B" corresponds to "Billy"). However, if you want to specify custom filter text, you need to use the data-filtertext attribute on the child element:

Example

  • data-filtertext="fav"

    Adele

  • Try it »

    Note If you use the data-filtertext attribute on an element, the element's original text content is ignored when filtering. To find the list item "Adele" in this case, the keywords you need to use are: f, a, v, or fav.

    More examples

    Filter collapsible lists
    How to filter a collapsible list.

    Filter tables
    How to filter table content.

    Filtering

    Element
    How to filter
    child elements contained in an

    .