Skip to content
Related Articles

Related Articles

jQuery Mobile Filterable classes Option

Improve Article
Save Article
  • Last Updated : 26 Jan, 2022
Improve Article
Save Article

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.

In this article, we are going to learn the jQuery Mobile Filterable classes option. The classes option is used to specify additional classes to add to the widget’s elements. 

Syntax:  

Initialize the filterable with the classes option specified, changing the theming for the ui-filterable class.

$( ".selector" ).filterable({ children: ".my-children" });
  • Get a property of the classes option:

    var themeClass = $( ".selector" )
        .filterable( "option", "classes.ui-filterable" );
  • Get a property of the classes option:

    $( ".selector" ).filterable( "option", 
        "classes.ui-filterable", "highlight" );

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 demonstrates the jQuery Mobile Filterable classes option.

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({});
            $(".btnclass").bind("click", function () {
                var classes = $( ".items" ).filterable(
                    "option", "classes.ui-filterable" );
                $("#divID").html("<b>Classes:" +
                    classes + "</b>"
                );
            });
        });
    </script>
</head>
<body>
<center>
        <div data-role="page" id="page1">
            <div>
                <h1 style="color:green;">GeeksforGeeks</h1>
                <h3>
                    jQuery Mobile Filterable classes Option
                </h3>
            </div>    
            <div role="main" class="ui-content">
                <div >
                    <ul class="items" style="list-style-type:none;">
                        <li>
                            <a href="https://www.geeksforgeeks.org/data-structures"
                            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>        
            <input type="button" Value="Classes Option"
                class="btnclass" />
            <br>
            <div id="divID"></div>
        </div>
    </center>
</body>
</html>


Output:

jQuery Mobile Filterable classes Option

 jQuery Mobile Filterable classes option

Reference: https://api.jquerymobile.com/filterable/#option-classes


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!