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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:14:01+00:00 2026-05-18T08:14:01+00:00

I have a question related to jquery. Basically I want to do a very

  • 0

I have a question related to jquery. Basically I want to do a very simple thing. I have a text input field. On submit, I want to display error message if the field is empty.
I have done this way:

 errMsg = "Please write name";              
    $("div#errMsg").css("background-color", "red");
     $("div#errMsg").html(errMsg);

and in the HTML:

<div id="errMsg"></div>
    <strong>Name:  </strong>
    <input name="name" id="name" type="text" maxlength="255" size="50" />

It works fine, however there is a problem. When I leave the field empty and it displays the error message, the error message does not go away without refreshing the page.
I am trying to do it so that when there is error message, and i type something in the field, it automatically remove the error without refreshing the page.
Any help would be much appreciated. Thanks.

  • 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-18T08:14:02+00:00Added an answer on May 18, 2026 at 8:14 am
    $('#name').keyup(function() {
    
       if ($(this).val()) {
           $("div#errMsg").fadeOut(100);
       }
    
    });
    

    Be sure to call show() $("div#errMsg") next time you display it.

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

Sidebar

Related Questions

Lots of style-related jquery autocomplete questions (yow), but none that want to "match the
I need some help for an assignment, I asked a question related to it
this question is related to c++ there is a library which declares a class
This question is related to calling scala code from java code. When I include
This is related to this question , but given the direction of the answers,
In relation with this question about how to write long SQL queries within C#.,
I have several questions about Tornado and other web frameworks. 1) Tornado claims to
I'm using SQLite with C# and have some tables with foreign keys defined. Now,
I am using Django 1.3 with built-in static app. My static folder structure is
Recently, while taking an introductory unit focused on Object Oriented programming, I was introduced

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.