jQuery Mobile Filtering
Filterable elements
All elements can be filterable if they have one or more child elements.
How to create a search field:
- The element you want to filter must use the data-filter="true" attribute.
- creation element and specify an id, and add the data-type="search" attribute to the element. This creates a basic search field. Place the element in a form, and the form
- Then add the data-input attribute to the filterable element. The value must be element to be opened.
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
Try it »
![]() |
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.
