Skip to content
Related Articles

Related Articles

jQuery Mobile Pagecontainer disabled Option

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 31 Jan, 2022

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 Pagecontainer disabled option to disable the specified pagecontainer widget.

Syntax: Initializing the pagecontainer disabled option.

$( ".selector" ).pagecontainer({
disabled: true
});
  • Setting the disabled option:

    $( ".selector" ).pagecontainer( "option", "disabled", true );
  • Getting the disabled option:

    var themeClass = $( ".selector" ).pagecontainer( "option", "disabled" );

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 Pagecontainer disabled Option.

HTML




<!doctype html>
<html lang="en">
  
<head>
    <meta name="viewport" content=
"width=device-width, initial-scale=1" />
    <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>
</head>
  
<body>
    <center>
        <div data-role="page" id="GFG1">
            <h1 style="color:green;">
                GeeksforGeeks
            </h1>
            <h3>jQuery Mobile Pagecontainer disabled Option</h3>
            <div data-role="header">
                <h1>First Page</h1>
            </div>
            <div role="main">
                <a href="#GFG2" data-transition="slide">
                    Go To Second Page</a>
            </div>
            <input type="button" id="Button" 
                   value="Value of the disabled option">
            <div id="log"></div>
        </div>
        <div data-role="page" id="GFG2">
            <h1 style="color:green;">
                GeeksforGeeks
            </h1>
            <h3>jQuery Mobile Pagecontainer disabled Option</h3>
            <div data-role="header">
                <h1>Second Page</h1>
            </div>
            <div role="main">
                <a href="#GFG1" data-rel="back" 
                   data-transition="slide">Go Back To First Page</a>
            </div>
            <input type="button" id="Button" 
                   value="Value of the disabled option">
            <div id="log"></div>
        </div>
    </center>
    <script>
        $(document).ready(function () {
            $("#GFG2").pagecontainer({
                disabled: true
            });
            $("#GFG2").pagecontainer(
                "option", "disabled", true);
            $("#Button").on('click', function () {
                var a = $("#GFG2").pagecontainer(
                    "option", "disabled"
                );
                $("#log").html(a);
            });
        });
    </script>
</body>
  
</html>

Output:

jQuery Mobile Pagecontainer disables Option

jQuery Mobile Pagecontainer disables Option

Reference: https://api.jquerymobile.com/pagecontainer/#option-disabled


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!