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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:41:37+00:00 2026-06-06T15:41:37+00:00

I have tried to boil this down to a simple example to demonstrate what

  • 0

I have tried to boil this down to a simple example to demonstrate what I’m running into.

I have a form with an input field and a submit button:

<form id="focusOutAfterInputForm">
  <input type="text" id="focusoutAfterInput">
  <input type="submit" >
  <div></div>
</form>

The input field has a focusout handler attached that inserts a new element below the input:

jQuery("#focusoutAfterInput").focusout(function() {
  jQuery(this).after("<div>message</div>");
});

I have also attached a submit handler just to capture if the submit is run:

jQuery("form").submit(function() {
  jQuery("#console").append("<li>submitted form" + this.id + "</li>");
  return false;
});

If the cursor is placed into the input and the submit button is clicked, the submit handler does not fire. If the submit button is clicked a second time it will fire. Also, if the field is blur’ed and then the submit button is pressed it will fire.

However, if instead we insert the new element below the div in the form, the submit button will fire even though the element is inserted:

<form id="focusoutAfterDivForm" novalidate="novalidate">
  <input type="text" id="focusoutAfterDiv" required="true">
  <input type="submit" >
  <div></div>
</form>

jQuery("#focusoutAfterDiv").focusout(function() {
  jQuery(this).parent().last().after("<div>message</div>");
});

Here is a jsfiddle demonstrating the code. I’m a bit baffled. Ideas anyone?

  • 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-06T15:41:39+00:00Added an answer on June 6, 2026 at 3:41 pm

    The problem doesn’t seem to be that submit isn’t executed, but rather the click event isn’t executed on the button, because the mouseup isn’t on the submit button once the div is inserted. If you use tab and space in your fiddle it works. Also if you add the element in a way that the submit button doesn’t move, it works:

    jQuery("#focusoutAfterInput").focusout(function() {
      jQuery(this).next().after("<div>message</div>");
    });
    

    or in this example: http://jsfiddle.net/K9vrW/3/

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

Sidebar

Related Questions

I have Googled this exception , and it seems to mostly boil down to
Have tried to find solutions for this and can't really come up with anything.
I have tried this but it does not work (even if I specify .wav
Have tried to fix this on my own and so far failed. The yellow
I have tried to embed a form inside a Scrollbox: procedure TfrmMain.FormCreate(Sender: TObject); var
I have tried this but Contacts were not added! ContentResolver cr = this.getContentResolver(); ContentValues
Have tried to compile and run this program, but have received this error message
have tried to use this my own function on FBJS: function addEvent(event,fun,pars){ pars.event=event; pars.listen=function(){
I have tried this in both gVIM and VIM the background is correctly applied
I have tried a lot to get this done but I dont know 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.