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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:45:11+00:00 2026-05-27T09:45:11+00:00

I am having some trouble with jQuery. I want to have a dialog box

  • 0

I am having some trouble with jQuery. I want to have a dialog box appear when the user clicks a link to delete something and prompt them to be sure that they actually want to delete it. The dialog box appears fine however I don’t see a way to get the url of the link when user clicks the “Yes” button. I tried using the event.relatedTarget property to get the url of the a tag but it is null. Does anyone know how to do this?

Code

<div id="dialog" title="Delete Run">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 0 0;"></span>Are you sure you want to delete that run?</p>
</div>
$(document).ready(function() {
    $('#dialog').dialog({
        autoOpen: false,
        width: 400,
        modal: true,
        draggable: false,
        resizable: false,
        buttons: {
            "Yes": function(event) {
                //Go to the url in $("a.delete")
            },
            "No": function() {
                $(this).dialog("close");
            }
        }
    });

    $("a.delete").click(function(){
        var url = $(this).attr("href");
        $('#dialog').dialog('open');
        return false;
    });
});
  • 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-27T09:45:11+00:00Added an answer on May 27, 2026 at 9:45 am
    <div id="dialog" title="Delete Run">
    <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 0 0;"></span>Are you sure you want to delete that run?</p>
    </div>
    $(document).ready(function() {
        $('#dialog').dialog({
            autoOpen: false,
            width: 400,
            modal: true,
            draggable: false,
            resizable: false,
            buttons: {
                "Yes": function(event) {
                    var url = $(this).data('url');
                    window.location = url;
                },
                "No": function() {
                    $(this).dialog("close");
                }
            }
        });
    
        $("a.delete").click(function(){
            $('#dialog').data('url', $(this).attr("href"));
            $('#dialog').dialog('open');
            return false;
        });
    });
    

    A little bit of guessing, as there is no element a.delete in your code ?
    Using jQuery’s data() is usually a better option than global variables.

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

Sidebar

Related Questions

I'm having trouble some jquery and was wondering if you could help. I have
I'm having some trouble with jQuery UI. I've created a dialog with jQuery UI:
I'm having some trouble with the jQuery hover method. Here's the relevant JavaScript code:
I'm having some trouble getting my head around the jquery queue method. I've got
I'm having some trouble getting binding to work with JQuery. <iframe id=wufooFormz7x3k1 height=281 allowtransparency=true
I'm having some trouble with finding the visibility param for JQuery. Basically... the code
I am having some trouble setting up FancyBox, I am somewhat new to jQuery.
I'm very new to JQuery, and I'm having some trouble understanding how to do
I'm having trouble getting some javascript and Jquery to delay the appropriate amount of
Using jQuery 1.7 I'm having trouble binding a Click event to some dynamically loaded

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.