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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:37:32+00:00 2026-05-13T16:37:32+00:00

My blur event hides the submit button; but doing that seems to cancel the

  • 0

My blur event hides the submit button; but doing that seems to cancel the submit event. I only want to hide when the submit itself wasn’t clicked. How can I determine if the focus was lost due to the submit, or due to just wandering off elsewhere?

<form action="" method="post">
    <textarea id="message" name="message"></textarea>
    <input type="submit" id="share" value="Share">
</form>
...

$('textarea').blur(function(){ 
     $('#share').hide() 
})
$('textarea').focus(function(){ 
     $('#share').show() 
})

Setting a timeout to allow the submit event to fire before coming back to the blur seems a bit hacky to me. Can’t we do better than that? Can I tell the blur not to block other events? or search the dom for a pending submit event? or … ?


Solution

for today is based on the ticked answer, but simpler. Use jquery’s “fadeOut” routine to

  1. delay the hidden status of the submit button until after the submit event has fired, and
  2. make the user feel like their submission is being handled

.

$('textarea').blur(function(){ 
     $('#share').fadeOut() 
})
$('textarea').focus(function(){ 
     $('#share').fadeIn() 
})

It’s indirect, and not really what I was looking for, but it seems clear that direct manipulation of the event queue – such as writing onBlur to say “if they did not click submit then hide the submit button” – is perhaps not technically possible.

  • 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-13T16:37:33+00:00Added an answer on May 13, 2026 at 4:37 pm

    This is one option, though a bit hacky using jQuery .queue() and .clearQueue() to set an animation queue and instantly clear it before anything happens:

       $(function() {
         $("#message").blur(function() {
           $("#share").delay(100).fadeOut();
         });
         $("#share").click(function() {
           $(this).clearQueue();
         });
       });
    

    Note: Requires jQuery 1.4+

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

Sidebar

Related Questions

Look at this: $('form).submit(function (event) { $(':input.required').trigger('blur'); var num = $('.warning', this).length; alert(num);//Focus here!
I am currently using $.blur(fn();) for form validation, but this only takes effect when
When I use blur event the input form clear. But I need blur event
Does any one tried to successfully hide the context menu at blur event? What
I have a small jQuery script: $('.field').blur(function() { $(this).next().children().hide(); }); The children that is
Does anyone know how to get the blur event to fire on the document
I have some code bound to the blur() event in jQuery: $('input[type=text]').blur(function () {
I have text input element and an event is fired on blur event and
I'm wondering how to add onblur=hcb.watermark.blur(event) onfocus=hcb.watermark.focus(event) style=color: rgb(136, 136, 136); to the following
The event $('#myInput').live('keyup blur', function(event) { //... } is not triggered when I select

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.