Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8721311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:12:02+00:00 2026-06-13T07:12:02+00:00

I use Jquery UI to open a pop up on a click but this

  • 0

I use Jquery UI to open a pop up on a click but this pop up is closed immediately.I don’t understand why?
Here is my code:

function openPopUp() {
    //  alert("Handler for .click() called.");
        $("#dialog:ui-dialog").dialog("destroy");
        $("#select-method").dialog({
            modal : true,
            height: 573,
            width: 766 ,
            buttons : {
                Exporter : function() {
                    //$(this).dialog("close");
                     alert("Exporter");
                    // close the dialog
                },
                'Etat de surveillance' : function() {
                    //$(this).dialog("close");
                     alert("Etat de surveillance");
                    // close the dialog
                },
                Annuler : function() {
                    //$(this).dialog("close");
                     alert("Annuler");
                    // close the dialog
                }
            }
        });
    };

The code html is:

<div id="other" class="popLink">This is text
        <a href="" class="popLink" onClick="openPopUp();">
        Click to open pop up
        </a>
</div>

<div class="noDisplay">
        <div id="select-method" title="selection des méthodes et calcul des provisions">My pop upis opened
            </div>
 </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:12:03+00:00Added an answer on June 13, 2026 at 7:12 am

    Like the one comment says, try something like this:

    onclick="openPopUp();return false;"
    

    Although it would make sense, since you’re already using jQuery, to bind the event with jQuery, not inline HTML. Instead of specifying the onclick attribute, try this in $(document).ready:

    $(".popLink").click(function (e) {
        e.preventDefault();
        // Either call openPopUp or copy/paste the code from that function into here - depends on how you actually use openPopUp throughout your whole site
    });
    

    But at the same time, you have something weird in your HTML – nested divs with the same class “popLink”. Which means that if you used my code above, when you click on the inner one, the showPopUp will execute twice (because of propagation). So I guess I would technically use this binding:

    $("#other").on("click", ".popLink", function (e) {
        e.preventDefault();
        // Other code
    });
    

    This technically binds the click event to the element #other, but only is executed if caused by an element inside of it that has the class “popLink”. There are several other ways to target the <a> you want, so it depends on if the code you provided is an example or is real.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably VERY simple and silly, but I am trying to use jQuery
I am using this code to open an html pop up, to which is
I'm trying to use changePage function in jQuery Mobile, but I want the page
In my web application I use jquery dialogs to open popups. The function used
I'm wanting to use the jquery dialog to open a modal dialog, and in
I use jQuery to do AJAX calls. But specialchars like ÆØÅ (danish letter) comes
I use jquery post function to go to server and bring the link to
I use jQuery to fade in a caption on a icon mouseover. $(#v1).mouseover(function() {
Better use chrome to open this site,any webkit browser may do too. https://www.google.com/intl/en/chrome/browser/ You
I am trying to use jquery to show confirmation dialog but nothing happens when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.