Open In App
Related Articles

jQuery Mobile panel toggle() Method

Improve Article
Save Article
Like 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 toggle() method to toggle the state of the panel, that is, if the panel is closed, it will open and if it is open it will be closed.


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

Arguments: This method does not accept any arguments.

CDN Links: We must include jQuery mobile in our code to use it.

<link rel=”stylesheet” href=”” />
<script src=””></script>
<script src=””></script>

Example: The below example demonstrates the use of the panel toggle() method.  


<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content=
          "width=device-width, initial-scale=1">
    <link rel="stylesheet" href=
    <script src=
    <script src=
        function togglePanel(){
            // Invoke the panel toggle() method
    <div data-role="page">
        <div data-role="header" >
            <h1 style="color:green;">GeeksforGeeks</h1>
            <h3>jQuery Mobile Panel toggle() method</h3>
        <div role="main" class="ui-content">
                <button onclick="togglePanel();" style="width:400px;"
                   Toggle Panel
        <div data-role="panel" id="divID">
            <button onclick="togglePanel();">Toggle Panel</button>



Last Updated : 10 Jan, 2022
Like Article
Save Article
Similar Reads
Related Tutorials