
- jQuery Mobile Tutorial
- jQuery Mobile - Home
- jQuery Mobile - Overview
- jQuery Mobile - Setup
- jQuery Mobile - Pages
- jQuery Mobile - Icons
- jQuery Mobile - Transitions
- jQuery Mobile - Layouts
- jQuery Mobile - Widgets
- jQuery Mobile - Events
- jQuery Mobile - Forms
- jQuery Mobile - Themes
- jQuery Mobile - CSS Classes
- jQuery Mobile - Data Attributes
- jQuery Mobile Useful Resources
- jQuery Mobile - Interview Questions
- jQuery Mobile - Quick Guide
- jQuery Mobile - Useful Resources
- jQuery Mobile - Discussion
jQuery Mobile - Filter Anything
Description
The filter widget can also be used to filter any element containing another element like a <div> element containing <p>.
Example
Following example demonstrates the use of filter anything in jQuery Mobile.
<!DOCTYPE html> <html> <head> <title>Filterable Anything</title> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <form> <input data-type = "search" id = "divOfPs-input"> </form> <div class = "elements" data-filter = "true" data-input = "#divOfPs-input"> <p><strong>Paragraph one</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit</p> <p><strong>Paragraph two</strong> sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p> <p><strong>Paragraph three</strong> quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequa </p> <p><strong>Paragraph four</strong> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p> <p><strong>Paragraph five</strong> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p> </div> </body> </html>
Output
Let's carry out the following steps to see how the above code works −
Save the above html code as filterable_anything.html file in your server root folder.
Open this HTML file as http://localhost/filterable_anything.html and the following output will be displayed.
jquery_mobile_widgets.htm
Advertisements