Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

jQuery Mobile panel close Event

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

jQuery Mobile is a JavaScript library used for creating responsive and accessible web applications for mobiles, tabs, desktops, etc. In this article, we will be using the jQuery Mobile Panel close event that is triggered after the panel has closed completely.



  • Initialize the panel with the close callback specified:

    $( ".selector" ).panel({
     close: function( event, ui ) {
         // Your code here
  • Bind the panelclose event to an event listener:

    $( ".selector" ).on( "panelclose", function( event, ui ) {} );

Parameters: It accepts a callback function that holds two parameters.

  • event: It accepts Event type value.
  • ui: It accepts Object type value. The ui object can be empty but used for consistency with other events across jQuery Mobile.

CDN Links:

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

Example: In the example below, we change the text of the paragraph with id “write” when the panel close event is fired.


<!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=
        $(document).ready(function () {
                close: function (event, ui) { 
                    $("#write").text("Panel close event fired.")
        function closePanel(){
    <div data-role="page">
        <div data-role="header" >
            <h1 style="color:green;">GeeksforGeeks</h1>
            <h3>jQuery Mobile Panel close event</h3>
        <div role="main" class="ui-content">
                <a href="#divID">Open Panel</a>
                <p style="background-color:green; 
                          color:white;" id="write">
        <div data-role="panel" id="divID">
            <button onclick="closePanel();">
                Close Panel




My Personal Notes arrow_drop_up
Last Updated : 07 Jan, 2022
Like Article
Save Article
Similar Reads
Related Tutorials