Open In App

jQuery Mobile Filterable filter Event

Last Updated : 30 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

jQuery UI is a web-based technology and consists of various GUI widgets, visual effects, and themes. These features can be implemented using the jQuery JavaScript Library. jQuery UI is the best tool for building UI interfaces for the webpages. It can also be used to build highly interactive web applications or can be used to add widgets easily.

The jQuery Mobile Filterable filter Event is used to trigger after the widget has performed the filtering on the list of children. The ui parameter contains the list of children that was processed.

Syntax:

We need to initialize the Filterable widget with the filter a callback function:

$( ".selector" ).filterable({ filter: function( event, ui ) {} });
  • Bind an event listener to the filterablefilter an event:

    $( ".selector" ).on( "filterablefilter", function( event, ui ) {} );

Parameters: These are the following parameters that are accepted:

  • event: This event is triggered after the widget has performed the filtering on the list of children.
  • ui: This parameter is of type object with below-given options.
    • items: This parameter is the jQuery collection object containing the items over which the filter has iterated.

CDN Link: Below are some jQuery Mobile scripts that will be needed for your project so add these to your project.

<link rel=”stylesheet” href=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css” />
<script src=”http://code.jquery.com/jquery-1.11.0.min.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

Example: This example describes the uses of the jQuery Mobile Filterable filter Event.

HTML




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet" 
          href=
    <script src=
    </script>
    <script src=
    </script>
    <script>
        $(document).ready(function () {
            $(".items").filterable({
                   filter : function (event, ui) {
                    $(".res").html ($(".res").html () 
                     + "<b>Filterable filter was triggered.</b><br>");
                   }
            });
        });
    </script>
</head>
<body>
 <center>
        <div data-role="page" id="page1">
            <div>
                <h1 style = "color:green;">GeeksforGeeks</h1>
                <h3>jQuery Mobile Filterable filter Event</h3>
            </div>
            <div role="main" class="ui-content">
                <div >
                    <ul class="items" style="list-style-type:none;">
                        <li>
                            <a href=
                               target="_blank">
                                Data Structures
                            </a>
                        </li>
                        <li>
                            <a href=
                              target="_blank">
                                Interview preparation
                            </a>
                        </li>
                        <li>
                            <a href="https://www.geeksforgeeks.org/java"
                               target="_blank">
                                Java Programming
                            </a>
                        </li>
                    </ul>
                </div>
            </div
            <div class="res"></div>
        </div>
    </center>
</body>
</html>


Output:

jQuery Mobile Filterable filter Event

jQuery Mobile Filterable filter Event

Reference: https://api.jquerymobile.com/filterable/#event-filter



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads