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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:18:25+00:00 2026-06-09T18:18:25+00:00

I have a javascript link that I’m using as a button on a popup:

  • 0

I have a javascript link that I’m using as a button on a popup:

<a href="#" class="submit-action close-modal">Submit</a>

The “submit-action” class has a jQuery .click() binding that performs a .submit() on the form that’s embedded inside the modal. The “close-modal” class has a .click() binding that closes the modal.

$(".submit-action").click(function() ($("#someForm").attr("action", "someURL"); 
$("#someForm").submit();

this.close = function () {
    $("#modal").hide();
    $.unblockUI();
};

$(".close-modal").click(function()(this.close);

Currently, when I click this button, the close-modal binding seems to be executing first and closing the modal before the form is submitted. So the popup closes without performing the submit. Is there a way I can force the “submit-action” binding to execute first without combining the two .click() bindings?

  • 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-06-09T18:18:27+00:00Added an answer on June 9, 2026 at 6:18 pm

    They fire in the order in which they are bound, so bind the close modal after you bind the submit action and it should go in the order you want.

    Fiddle 1: http://jsfiddle.net/johnkoer/2xNwn/1/

    Fiddle 2: http://jsfiddle.net/johnkoer/2xNwn/2/

    From the JQuery documentation (emphasis mine):

    By default, most events bubble up from the original event target to
    the document element. At each element along the way, jQuery calls any
    matching event handlers that have been attached. A handler can prevent
    the event from bubbling further up the document tree (and thus prevent
    handlers on those elements from running) by calling
    event.stopPropagation(). Any other handlers attached on the current
    element will run however. To prevent that, call
    event.stopImmediatePropagation(). (Event handlers bound to an element
    are called in the same order that they were bound.
    )

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

Sidebar

Related Questions

I have Javascript function that is adding css class current to selected link <a>
I have this link that fills an input when clicked. <a href=# onclick=javascript:document.getElementById('input').value='<?php echo($ms);
I have a JavaScript link that is as follows: <a href=# onclick=window.open('TrackPackage.asp?track=235&ship=OTHER&ShippingMethod=1', '', 'location=1,menubar=1,scrollbars=1,status=1,resizable=1,width=635,height=460');
I have a link that uses javascript to submit a form, like so: <a
I have a javascript (jquery) snippet that is link to a href=# to toggle
I have a javascript link that references another .js file. I've been trying to
I have a link, that when I click it calls a javascript function with
I have a link that is somewhat like this: <a href=------.html#video>Text</a> It works fine
I have index.php like this: <script type=text/javascript src=jquery-1.4.2.js></script> <script type=text/javascript src=ajax.js></script> <a href='one.php' class='ajax'>One</a>
I have this JavaScript that adds a form field, along with a link to

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.