Skip to content
Related Articles

Related Articles

jQuery Mobile Dialog close() Method

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 15 Dec, 2021

jQuery Mobile is a web technology used to make responsive websites and apps which are accessible on smartphones, tablets, and desktop devices. In this article, we will use jQuery Mobile Dialog Widget’s close() method to close an opened dialog. When the close() method is invoked on any dialog widget, it simply closes the dialog. This method does not accept any parameters.



Parameters: This method does not accepts any parameters.

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

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



<!DOCTYPE html>
    <title>GeeksForGeeks - Dialog Close</title>
    <meta name="viewport" content=
        "width=device-width, initial-scale=1" />
    <link rel="stylesheet" href=
    <script src=
        // This method will be called when the 
        // button inside the dialog will be clicked.
        function closeDialog() {
            // Invokes close() method on #div2's dialog
    <div id="div1" data-role="page">
        <div data-role="header">
            <h4>jQuery Mobile Dialog close() Method</h4>
        <div data-role="content">
                <a href="#div2">
                    Click to Show the Dialog Box
    <!-- id ="div2"-->
    <div id="div2" data-role="dialog">
        <div data-role="header">
            <h1>jQuery Mobile - GFG</h1>
        <div data-role="content">
            jQuery Mobile - Dialog close() method example.
            <button onclick="closeDialog();">
                This Button Closes the Dialog


Dialog Close() Method


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!