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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:09:23+00:00 2026-05-31T19:09:23+00:00

I have a form with input fields and a button which fades in when

  • 0

I have a form with input fields and a button which fades in when you focus in any field.

I would like to make the button disappear when user clicks somewhere outside the form.
Just blur on input elements doesn’t work. As soon as you focus away of the input text field to press a submit button, the button disappears so you cannot press it.
I tried to have a blur method on form, but it didnt seem to work as well.

Thank you for any help.

$("#add_wall").click(function(){
    $("#new_wall").animate({
        opacity: 1,
        width: '350'
    }, 500, function() {
        $("#send_button").fadeIn(400);
    });
}); 

Form looks like

<form id="add_wall">
    <input id="new_wall" type="text"  placeholder="Compose new message..." />
    <button id="send_button" style="width:60px; margin-left:5px;" >Post</button>
</form>
  • 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-31T19:09:24+00:00Added an answer on May 31, 2026 at 7:09 pm

    You should be setting your field itself to have the .focus() listener, rather than the wrapping <form>.

    $('#new_wall').focus( function(){
        $("#send_button").fadeIn(400);
    });
    
    $('#new_wall').blur( function(){
        $("#send_button").fadeOut(400);
    });
    

    Blur should work on the field. You can’t “unfocus” from something that can’t have focus (like an <a> or <input>).

    Example: http://jsfiddle.net/7p77p/

    I don’t know what you’re trying to do with your field when someone “clicks” on the form (not a solid interaction with the form), so I’m going to ignore that for now. Your field should carry the focus and blur events, however, and your button should respond in kind.

    Edit: Based on silly oversight on my part.

    Then the way I would handle it is this:

    $('#new_wall').focus( function(){
        $("#send_button").fadeIn(400); // Button shows on focus
    
        // Create a temporary listener on the body to let someone 'click off'
        $('body').on('click.send_button_showing', function(){
            // User clicks off, button fades out, loses event, and body loses event
            $('#send_button').fadeOut(400);
            $('#send_button').off('click.send_button_click');
            $('body').off('click.send_button_showing');
        });
    
        // Create temporary event that stops bubbling of the body click 
        // with .stopPropagation()
        $('#send_button').on( 'click.send_button_click', function(e){
            e.stopPropagation();
            // Do your send button actions
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a few input fields. When a user clicks on
I have a very simple web form which consists of labels and input fields,
I have a form which contain some radio button and check-boxes . Whenever user
I have a few input fields in a form which are submitted using Save
I have a form which contains 4 text fields when the button is clicked
I am using Codeigniter framework and I have a form with input fields. When
I have a form with many input fields. When I catch the submit form
I have a form where users can add input fields with jQuery. <input type="text"
I have a shipping/billing input form and I'm having trouble styling the input fields
I am using ASP.NET2.0. I have created a download form with some input fields

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.