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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:24:14+00:00 2026-05-29T07:24:14+00:00

First time I’m touching JQuery let alone javascript. Worked with this for about 20

  • 0

First time I’m touching JQuery let alone javascript. Worked with this for about 20 minutes and need a wee-bit-o help.
My javacript: !!!EDIT!!! just changed to this now

function val_fade1() {
    $("#firstname").bind('keydown', function(){
        var firstnameCount = $(this).val().length;
    }
    $("#lastname").bind('keydown', function(){
        var lastnameCount = $(this).val().length;
    }
    $("#email").bind('keydown', function(){
        var emailCount = $(this).val().length;
    }
    $("#password").bind('keydown', function(){
        var passwordCount = $(this).val().length;
    }
    if(firstnameCount < 2) {
        $("#req_first").show("slow");
    } else if(lastnameCount < 2) {
        $("#req_last").show("slow");
    } else if(emailCount < 5) {
        $("#req_email").show("slow");
    } else if(passwordCount < 5) {
        $("#req_pass").show("slow");
    } else {
        $("#register1").fadeOut();
    }
}

So now what I’d like to have happen is like say you were entering your firstname and it was less than 2 characters, the label that I have currently hidden with CSS that says (please enter a longer name) would show up. As well as the other fields (lastname, email, password). But if all of them are filled out correctly, the “register1” div will fade out.

Here are the parts of my HTML just in case you would need it:

<label>First Name
    <label id="req_first">REQUIRED*<label> 
</label>
<input type="text" name="firstname" id="firstname" class="input-text2" />

<label>Last Name 
    <label id="req_last">REQUIRED*</label>
</label>
<input type="text" name="lastname" id="lastname" class="input-text2" />

<label>E-Mail Address 
    <label id="req_email">REQUIRED*</label>
</label>
<input type="email" name="email" id="email" class="input-text2" />

<label>Password 
    <label id="req_pass">REQUIRED*</label>
</label>
<input type="password" name="password" id="password" class="input-text2" />

And the CSS hides the REQUIRED* labels simply like this:

<style>
#req_first {
    display:none;
}
#req_last {
    display:none;
}
#req_email {
    display:none;
}
#req_pass {
    display:none;
}
</style>

I’m very, very new to JS and JQuery so if you could please explain to me how to make this work , I’d be very greatful, I work mainly with PHP and have PHP validation, but I like the appeal of JQuery fade ins and the PHP could be backup if someone decided to turn off their JS.

Thanks so much guys!
-mike

  • 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-29T07:24:15+00:00Added an answer on May 29, 2026 at 7:24 am

    First correct yout HTML and CSS, i have created a prototype, this may help you.

    DEMO

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

Sidebar

Related Questions

First time posting, please let me know if this question has already been answered!
First time working with javascript and JSON. Curious why this causes a comiler error:
( First time programming in PHP. Had some help. Need a bit more. )
First time I've had to do this, but I need to save the results
first time poster and TDD adopter. :-) I'll be a bit verbose so please
first time posting in StackOverflow. :D I need my software to add a couple
First time poster here. A quick question about setting up a loop here. I
First time posting here, will try to be succinct. This is a classic 'can't
First time installing RoR and things are a bit confusing. I first installed Ruby
First time using this technique, seems that regardless what attributes I try to assign

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.