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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:55:49+00:00 2026-06-02T06:55:49+00:00

When i used blur event out of input text field, it include all page,

  • 0

When i used blur event out of input text field, it include all page, but submit button too. So how to avoid that the blur event do not include submit button?

Here is html code:

<form>
   <input type="text" value="EMAIL ADDRESS_" id="text" />
   <input type="submit" val="" id="submit" />
</form>

and script:

$('form input[type!=submit]').focus(function(){
     $(this).val("");
     });
$('form input[type!=submit]').blur(function(){
     if(this.value==""){
     $(this).val("EMAIL ADDRESS_");
  }
});

I take this code from my previous question, but it doesn’t work.Blur event still include submit button

  • 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-02T06:55:51+00:00Added an answer on June 2, 2026 at 6:55 am

    I think instead of avoiding one field from the selection, you should better specify the items to be considered for selection. Otherwise if someone / you, in the futue may add a new element to the form and you may be wondering where this behaviour (of blur and focus) is coming from for the “just now added element” !

    $(function(){
     $("form input[type='text']").focus(function(){
           $(this).val("");
         });
     $("form input[type='text']").blur(function(){
         if(this.value==""){
            $(this).val("EMAIL ADDRESS_");
          }
      });
    });
    

    Note that you are still targeting all input fields which is of type text. So if possible try to make it more specific by applying a class name to those elements and use that as the selector. Or you may use the id of the element as well.

    $("form #yourElemntId").focus(function(){
       //do stuff
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 4 textboxes on my page. I used jquery focus and blur functions
A form has a input field which would contain text values . There is
I have this JavaScript which is used for creating shadow into input field: <!--
In here one field named to[0] is used...but actually I have them 'N' times
I used Session[EmpName] = Convert.ToString(Request.QueryString[1]); lblEmployeeName.Text = Session[EmpName].ToString; to show the data in label
I'm looking to implement event delegation on blur/focus events, in a similar way to
I have an input field where a user can paste a link. I would
I used this example to make the screen blur to focus attention. http://blog.wpfwonderland.com/2010/03/23/use-the-wpf-blur-effect-to-focus-attention/ I
how to validate joomla default text editor on blur using jQuery? This is the
I've created collapsible links for navigating my page. All menu items in my navigation

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.