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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:28:00+00:00 2026-05-28T17:28:00+00:00

I have an email text box that contains the text ‘(Not Required)’ until a

  • 0

I have an email text box that contains the text ‘(Not Required)’ until a user clicks on it, at which point it turns blank. I’m trying to make it to where if the user clicks another text box without entering an email address (or entering anything), the text box will revert to containing (Not Required).

Here’s what I have:

$(document).ready(function () {

   $('#email').val("(Not Required)");

   // this part works fine
   $('#email').click(function(){
       if ($(this).val() == '(Not Required)'){
           $(this).val('');
       }
   });

   // this isn't working
   $(':text').click(function(){
       var em = $('#email').val().length();
       if (em<3){
           $('#email').val('(Not Required)');
       }
   });

});

I can’t figure out why the second part isn’t working correctly. Any help would be rewarded with a lifetime’s devotion to yourself from myself in a very big way. Forever.

  • 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-28T17:28:01+00:00Added an answer on May 28, 2026 at 5:28 pm
    var em = $('#email').text().length();
    

    Should be

    var em = $('#email').val().length;
    

    And I show you a better way do this by chain method:

    $(document).ready(function () {
    
        $('#email').val("(Not Required)").foucs(function() {
            $(this).val('');
        }).blur(function() {
            if ($(this).val().length < 3 ){
               $(this).val('(Not Required)');
            }
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Email Id text box. My requirement is that an user enters
I have a form, that has about 10 text entries (user, address, email etc;)
my Problem is that I have an asp text box which has a value
I have a dialog box that appears when the user clicks a macro button.
I have a text in an email on a windows box that looks something
I have a text box that is intended for an Email address. I am
I have a small job that takes a text file of email/zip codes and
I have a table memberships . I supply my user with a text box,
I have a textBox control that lets the user their email address/addresses. The use
I currently have a text box in a program where the user can input

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.