Skip to content
Related Articles
Open in App
Not now

Related Articles

jQuery Mobile Flipswitch classes Option

Improve Article
Save Article
  • Last Updated : 20 Dec, 2021
Improve Article
Save Article

jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. 

In this article, we will be using the jQuery Mobile Flipswitch classes option to specify additional classes to add to the widget elements.

Syntax:

$( ".selector" ).flipswitch({
  classes: {
    "ui-flipswitch": "highlight"
  }
});

Parameters: It accepts an object type value that specifies the additional classes to add to the widget elements.

 

CDN Link: First, add jQuery Mobile scripts needed for your project.

<link rel=”stylesheet” href=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css”>
<script src=”//code.jquery.com/jquery-3.2.1.min.js”></script>
<script src=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js”></script>

Example: This example describes the jQuery Mobile Flipswitch classes option.

HTML




<!doctype html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
"//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css">
    <script src=
"//code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src=
"//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js">
    </script>
  
    <style>
        .Geeks {
            width: 100px;
            height: 30px;
            border-radius: 20px;
        }
    </style>
  
    <script>
        $(document).ready(function () {
            $("#GFG").flipswitch({
                classes: {
                    "ui-flipswitch": "Geeks"
                }
            });
        });
    </script>
</head>
  
<body>
    <div data-role="page">
        <div data-role="header">
            <h1>GeeksforGeeks</h1>
            <h3>jQuery Mobile Flipswitch classes Option</h3>
        </div>
  
        <div class="ui-field-contain">
            <form>
                <div data-role="fieldcontain">
                    <label for="GFG">
                        Flipswitch Checkbox:
                    </label>
  
                    <input type="checkbox" id="GFG" 
                        data-role="flipswitch">
                </div>
            </form>
        </div>
    </div>
</body>
  
</html>


Output:

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


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!