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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:03:13+00:00 2026-05-23T15:03:13+00:00

This is an extension to a previous question which was answered. But have a

  • 0

This is an extension to a previous question which was answered. But have a different need/issue. Here is the jquery code:

$("#deletec-box").dialog({
    autoOpen: false,
    resizable: false,
    height:230,
    modal: true,
    buttons: {
        "Confirm": function() {
            window.location = $('#deletec-confirm').attr('href');
            $(this).dialog("close");
        },
        Cancel: function() {
            $(this).dialog("close");
        }
    }
});

$("#deletec-confirm").click(function() {
    $("#deletec-box").dialog("open");
    return false;
});

Here is the original link:

<a href="?action=delc&cid=2" id="deletec-confirm">Delete</a>

But I have multiple links on one page with the same id. So I changed the link to:

<a href="?action=delc&cid=2" id="deletec-confirm10">Delete</a>
<a href="?action=delc&cid=2" id="deletec-confirm9">Delete</a>
<a href="?action=delc&cid=2" id="deletec-confirm12">Delete</a>

How would I dynamically get the link the person clicked on to get the dialog? Right now it gets the url like so:

window.location = $('#deletec-confirm').attr('href');

Do I change the id to a class in the link? Or is there another way to dynamically select the id of the link so I can keep the id= attribute for each link?

Side note, if this is considered duplicate please let me know what I need to do.

  • 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-23T15:03:14+00:00Added an answer on May 23, 2026 at 3:03 pm

    I recommend you to use a common class to all your links. like this:

    <div id="deletec-box">Are you sure you want to delete?</div> 
    <a href="?action=delc&cid=2" class="deletec-confirm">Delete</a>
    <a href="?action=delc&cid=2" class="deletec-confirm">Delete</a>
    <a href="?action=delc&cid=2" class="deletec-confirm">Delete</a>
    

    Then, you could store the ‘clicked link’ with .data()

    $("#deletec-box").dialog({
        ...
        buttons: {
            "Confirm": function(idx) {
                window.location = $('#deletec-box').data('openerLink').attr('href');
                $(this).dialog("close");
            },
            ...
        }
    });
    
    //By binding with a class, you bind once for all
    $(".deletec-confirm").click(function() {
        $("#deletec-box").data("openerLink", $(this)); //Store the link in the dialog
        $("#deletec-box").dialog("open");
        return true;
    });
    

    The advantage of using .data() is that you don’t use global vars, and store what you want only where you want.

    Hope this helps.

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

Sidebar

Related Questions

this is an extension to my previous post today which can be found here:
This is an extension of the question I asked here I have a relationship
This is a expansion on to a previous question that got answered yesterday, which
Hello every one this is extension to my previous question.Here is the link File
this is an extension to a previous question I asked , today .... which
this question is an extension to a previous question i asked (and was answered).
Hello every one this is basically extension to my previous question. i have write
this question is an extension of my previous question that you can find here:
This is an extension of a question I previously asked here . Long story
This is an extension to a question which I asked some time ago. I

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.