Skip to content
Related Articles

Related Articles

jQuery Mobile Popup open() Method

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

jQuery Mobile is a web-technology used to create responsive and accessible websites and web applications. It is built on top of jQuery.

In this article, we will use jQuery Mobile Popup open() method to open the popup using the specified option(s).


$( ".selector" ).popup( "open", options );

Here the options parameter is of type object which accepts 4 keys:

  • x: The x-coordinate where you want to display the popup.
  • y: The y-coordinate where you want to display the popup.
  • transition: It defines which transition to use when opening the popup. It accepts a String and the default value is an empty string.
  • positionTo: A jQuery Selector can be used to define the position where the popup is to be displayed.

CDN Links: First, add jQuery CDN links to the project.

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

Example: In the example below we used positionTo option to define where we want to open the popup.


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible"
          content="IE=edge" />
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0" />
    <title>Popup - reposition method</title>
    <link rel="stylesheet"
    <script src=
    <script src=
    function openPopup(){
        $( "#popup1" ).popup( "open", 
                             {positionTo: "#target"} );
    <div data-role="page">
        <h2 style="color: green">GeeksforGeeks</h2>
        <h3>jQuery Mobile Popup open Method</h3>
        <p id="target">Popup will open here</p>
        <div data-role="popup" id="popup1">
          <p>Welcome to GeeksforGeeks</p>
        <button onclick="openPopup()">
          Open Popup


jQuery Mobile Popup open() Method


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!