Skip to content
Related Articles
Open in App
Not now

Related Articles

jQuery Mobile panel open() Method

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

jQuery Mobile is a JavaScript library that is used to develop responsive websites and web applications. It is built on top of jQuery. In this article, we will use the jQuery Mobile panel open() method to open a panel. The panel open() does not accept any arguments. 

 

Syntax:

$(".selector").panel( "open" );

Parameters: This method does not accept any arguments.

CDN Links:

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

Example: Below example demonstrates how to open a panel using the open() method.

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>
        function openPanel(){
            // Invoke the open method of panel
            $("#divID").panel("open");
        }
    </script>
</head>
  
<body>
    <div data-role="page">
        <div data-role="header" >
            <h1 style="color:green;">GeeksforGeeks</h1>
            <h3>jQuery Mobile Panel open method</h3>
        </div>
  
        <div role="main" class="ui-content">
            <center>
                <button onclick="openPanel();"
                        style="width:400px;"
                      Open Panel 
                </button>
            </center>
          </div>>
  
        <div data-role="panel" id="divID">
            <h3>GeeksforGeeks</h3>
            <p>This is a panel</p>
  
        </div>
    </div>
</body>
  
</html>


Output:

jQuery Mobile panel open() Method

Reference: https://api.jquerymobile.com/panel/#method-open


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!