Open In App

jQuery Mobile Controlgroup container() Method

Improve
Improve
Like Article
Like
Save
Share
Report

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 learn about the jQuery Mobile Controlgroup container() method. This method is used to obtain the container element within which the child elements of the Controlgroup are to be placed.

Syntax:

$( ".selector" ).controlgroup( "container" );

Parameters: This method does not accept any parameters.

Return Values: This method does not return any values.

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

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

Example: This example describes the jQuery Mobile Controlgroup container() Method.

HTML




<!doctype html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
"//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script src=
"//code.jquery.com/jquery-1.10.2.min.js">
    </script>
    <script src=
"//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
    </script>
  
    <script>
        $(document).ready(function () {
            $("#GFG").controlgroup({
                defaults: true
            });
        });
    </script>
</head>
  
<body>
    <center>
        <div data-role="page" id="page1">
            <h1 style="color:green;">
                GeeksforGeeks
            </h1>
            <h3>jQuery Mobile Controlgroup 
                container() Method</h3>
            <div role="main" class="ui-content">
                <div data-role="controlgroup" 
                     id="GFG">
                    <a href=
                       class="ui-btn">
                        Data Structure
                    </a>
                    <a href=
                       class="ui-btn">
                        Algorithm
                    </a>
                    <a href=
                       class="ui-btn">
                        Web Development
                    </a>
                    <a href=
                       class="ui-btn">
                        Java Programming
                    </a>
                </div>
            </div>
        </div>
    </center>
    <script>
        $(document).ready(function () {
            $("#page1").controlgroup("container");
        });
    </script>
</body>
  
</html>


Output:

jQuery Mobile Controlgroup container() Method

Reference: https://api.jquerymobile.com/1.4/controlgroup/#method-container



Last Updated : 12 Feb, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads