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

  • Home
  • SEARCH
  • 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 956075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:29:12+00:00 2026-05-16T00:29:12+00:00

I have a HTML table that displays rows of records and has a column

  • 0

I have a HTML table that displays rows of records and has a column on the end with a delete link. Each delete link has a class of confirm-delete. I need to have a confirm dialog popup on click and as it is used in multiple pages, have created a confirm function in an external JS file.

I have added the function call to the link’s click using jQuery [code at bottom of post] and it works fine until the dialog has been confirmed once [user has clicked OK]. Then the function is no longer called.

I think I am missing something pretty simple though as I don’t use JS/jQuery much I may have a gap in my knowledge. Why does it work fine until the first OK? It appears to be storing a reference to the result and reusing it rather than a unique one for each link.

Here’s the code when used on the Notes page:

$(function() {
        // Add Confirmation dialogs for all Deletes
        $("a.confirm-delete").click(function(event) {
            return fConfirmDelete('Note');
        });
});

And the fConfirmDelete function

function fConfirmDelete( deleteObj ) {
    return confirm('Are you sure you wish to delete this ' + deleteObj + '?');
} 
  • 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-16T00:29:13+00:00Added an answer on May 16, 2026 at 12:29 am

    After the user clicks OK the first time, do you somehow reload the table dynamically? If so, it could be that the event isn’t bound to the re-loaded table. Try a live event handler instead:

    jQuery 1.7+

    $(function() {
            // Add Confirmation dialogs for all Deletes
            $(document).on('click', 'a.confirm-delete', function(event) {
                return fConfirmDelete('Note');
            });
    });
    

    jQuery 1.3-1.8:

    $(function() {
            // Add Confirmation dialogs for all Deletes
            $("a.confirm-delete").live('click', function(event) {
                return fConfirmDelete('Note');
            });
    });
    

    In your original code, $("a.confirm-delete").click(...) will only bind the event to a.confirm-delete objects already in the DOM. If you add a new a.confirm-delete element later, the event is not bound to it. By using jQuery’s live event handler, the event will be bound to any a.confirm-delete elements that currently exist or any that get created dynamically.

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

Sidebar

Related Questions

I have an html table that displays maintenance records. There are 3 columns that
I have an HTML table that contains some 500 rows. I have an input
I have an HTML/XML table generated by AJAX that displays limited columns of a
I have a html table which has several rows - lets say 17 for
I have a page with a table on it that has several thousand rows
I have a table with multiple rows, each row has: layout (select) images *
i have a page that displays large datasets into html tables. how can i
I have an HTML table that I'd like to be able to export to
I have an html table that looks like this in a standard HTML 4.01
I have an html table containing values that are being generated from javascript. How

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.