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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:57:25+00:00 2026-05-17T22:57:25+00:00

I have the following code that simply uses a jquery ui modal dialog to

  • 0

I have the following code that simply uses a jquery ui modal dialog to “confirm” any click on a link. If they click OK, then it sends them to the original link. It works fine, so don’t bother reading it in too much detail =)

    $('.confirm').live('click', function(e) {
  e.preventDefault();
  var theHref = $(this).attr('href');
  var confirmText = 'Are you sure?';
  if ($(this).attr('confirm')) {
   confirmText = $(this).attr('confirm');
  }
  confirmDialog.html(confirmText);
  confirmDialog.dialog({
   buttons: {
    'OK': function() {
     window.location = theHref;
     $(this).dialog('close');
    },
    Cancel: function() {
     $(this).dialog('close');
     return false;
    }
   }
  });
  confirmDialog.dialog('open');
  return false;
 });

Then, I have a bunch of other arbitrary functionality. Like, say this:

    $('a.reset').live('click', function(e) {
  e.preventDefault();
  $(this).parents('form')[0].reset();
 });

That’s just a link that resets a form (like an input type = reset). This functionality also works fine. Please note this is just an arbitrary example. I’ve got plenty of different snippets of JS functionality that I attach via classes.

The problem I am encountering is stacking these two. In this example, some reset links I might want confirmations, some I might not. Like so:

<a href="" class="reset confirm">Reset on confirmation</a>
<a href="" class="reset">Reset without confirmation</a>

The problem of course, is that the first example doesn’t care about the confirm – it just goes ahead and resets. Is there some way I can continue to keep these bits of code separate and modular (like in the HTML example), while at the same time making one dependent on the output of the other?

I hope it is clear what I’m trying to achieve.

Thanks in advance for any assistance. First time posting on here so be nice =)

  • 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-17T22:57:25+00:00Added an answer on May 17, 2026 at 10:57 pm

    I don’t know if this will work, but try creating the .live handlers in reverse order. I think they might get triggered from last attached to first attached.

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

Sidebar

Related Questions

No related questions found

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.