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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:08:36+00:00 2026-06-04T12:08:36+00:00

I have this markup:- <textarea id=TextBox1></textarea> <span id=validator></span> And the following jQuery:- jQuery(‘#TextBox1’).live(‘input’, function()

  • 0

I have this markup:-

<textarea id="TextBox1"></textarea>
<span id="validator"></span>

And the following jQuery:-

jQuery('#TextBox1').live('input', function() {
    var charLength = $(this).val().length;
    $('#validator').html(charLength + ' of 250 characters used');
    if ($(this).val().length > 250) {
        $('#validator').html('<strong>You may only have up to 250 characters !</strong>');
    } 
});

This works fine.

I wish to modify the above jQuery so that the #validator fades in when it appears and also fades out if the length drops to 0 (doesn’t do this currently, message stays on the screen).

EDIT: Forgot to add, I have the following function also:-

jQuery.fn.fadeInOrOut = function(status) {
    return status ? this.fadeIn() : this.fadeOut();
}; 

I have tried the following but it doesent seem to have any effect:-

$('#validator').html(charLength + ' of 250 characters used').fadeInOrOut(!! charLength);

and…

$('#validator').html(charLength + ' of 250 characters used');
$('#validator').fadeInOrOut(!! charLength);
  • 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-04T12:08:37+00:00Added an answer on June 4, 2026 at 12:08 pm

    see this: http://jsfiddle.net/CsXU8/3/

    You need to hide the validator onload (with css). else it cannot fade in.

    So adding this line in your css:

    #validator {display:none}
    

    should do the trick.

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

Sidebar

Related Questions

I have this jQuery: $('.infoExpand p').hide(); $('.infoData').click(function(){ $('.infoData').removeClass('infoDataHov'); $(this).addClass('infoDataHov'); var id = this.id; id
I have this markup, <a href=http://www.example.com>Hiya<span class=delete>Delete</span></a> And my js, $('.delete').click(function() { window.location =
Suppose I have this html markup: <div id=wrapper> <pre class=highlight> $(function(){ // hide all
I have the following short markup. I try to view this page in browser
I have this markup <div class=input text> <label for=Experience0ExperienceContent>Experience Content</label> <input name=data[Experience][0][experience_content] class=span3 id=Experience0ExperienceContent
i have this markup <input tabindex=5 type=text class=bgFecha date-pick id=date2 value=12/03/2011 name=date2/> Please note
I have this markup <dt id=dt0> &nbsp; </dt> <dd id=dd0dd> <textarea id=dd0></textarea> </dd> <dt
Suppose I have this markup: <div id=#titles> <p>Intro text <span>text text</span> text text</p> <ul>
I have this markup in an MVC app. <div id=ingredientlistdiv> <% Recipe recipe =
For example I have this markup: Test text<br> test2 text That inside it needs

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.