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 466641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:30:03+00:00 2026-05-12T23:30:03+00:00

All- I know this has been asked, but the previous solutions don’t seem to

  • 0

All-
I know this has been asked, but the previous solutions don’t seem to apply to my situation.

I have a simple table with a number of records in each row, with the final column being a delete hyperlink. I’m trying to use the dialog to pop up and confirm delete. This works perfectly if I use explicit names of the div where the dialog is (I position it exactly one div above the div where the table is). I use a destroy first which seems to solve the “only opens once” problem, as long as as I name the dialog div. I’m trying to universalize the code, so I’d rather get away from explicitly naming the div where the dialog will live, but rather refer to the prev div. This works the first time, but subsequent clicks do not:

<code>
   $(".deleteLinkDiag a").livequery('click',function() {

    var myParent = $(this).parents("div:eq(0)"); //container div to be replaced
    var myDiag   = $(myParent).prev("div");     //one div before container div
    var urlLoad = $(this).attr("href");
    $(myDiag).dialog('destroy');
    $(myDiag).dialog({ 
            bgiframe: true,
            resizable: false,
            height:140,
            modal: true,
            autoOpen: false,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.5
            },
            buttons: {
                    "Confirmz":function() 
                    { 
                        myParent.load(urlLoad, function() { });
                        $(this).dialog("close");
                     },
                    Cancel: function() 
                    {  
                        $(this).dialog("close");
                    }
            },
            //close: function(ev, ui) { $(this).dialog('destroy');}
      });
     $(myDiag).dialog('open');
return false;
});
</code>

Any ideas?

  • 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-05-12T23:30:03+00:00Added an answer on May 12, 2026 at 11:30 pm

    OKay, so hopefully this will help someone down the road. I actually had two problems going on:

    1. If you dont’ destroy the dialog(), then it doesn’t really exist in the DOM under the old name. That’s why it was always undefined the second time through.
    2. Even if you DO destroy the dialog, you still can’t find it. That’s because when dialog theoretically returns it to pre-init state, it does so by dropping it at the bottom of the DOM right before the body tag. So, it’s no longer in “prev” , or “prevAll”.

    I got around this by just setting the name of the dialog box to be the same as the calling div, appended with “Diag”. Then I can track it no matter where jquery puts it. Whew.

    $(".deleteLinkDiag a").livequery('click',function() {
                var urlLoad = $(this).attr("href");
                var myParent = $(this).parents("div:eq(0)"); //container div to be replaced
                var myDiag = myParent.attr('id') + 'Diag';
                $("#" + myDiag).dialog({
                        bgiframe: true,
                                resizable: false,
                                height:140,
                                modal: true,
                                autoOpen: false,
                                overlay: {
                                        backgroundColor: '#000',
                                        opacity: 0.5
                                },
                        buttons: {
                                        "Confirm":function()
                                        {
                                                myParent.load(urlLoad, function() { });
                                                $(this).dialog("close");
                                         },
                                        Cancel: function()
                                        {
                                                $(this).dialog("close");
                                        }
                                  },
                        close: function(ev, ui) {
                                $(this).dialog("destroy");
                        }
          });
         $("#" + myDiag).dialog('open');
        return false;
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked multiple times but all the answers seem
I know this has been asked before , but I don't think these solutions
I know this has been asked several times and I have read all the
I know this topic has been asked, but the posts are all out of
I know this question has been asked several times, but I can't quite seem
I know this question has been asked here before, but I don't think those
I know this has been asked before, but I've followed all guides and somehow
I know this has been asked before. But I have exhausted the options given
I know this has been asked, but all of the threads I find do
I know this has been asked in various ways, but I have not been

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.