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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:55:13+00:00 2026-06-12T19:55:13+00:00

After extensive searching on this matter, I have been unable to find an answer

  • 0

After extensive searching on this matter, I have been unable to find an answer on my own for an issue I’m experiencing where the jQuery validation plugin is cannibalizing a character count plugin I’m using for an SMS-via-PHP form.

If you get into the form, on the front-end, and start typing in the text area, the counter works just fine, and of course the validation won’t fire since there’s text in the element… but, in the interest of testing, if you try to submit the form without a message, the validation fires, and the error message is displayed relative to the textarea, and when you input copy, the validation message goes away, but the character counter no longer works.

Here’s the character counter I’m using: http://cssglobe.com/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas/

Here’s the way I have my script laid out:

$(function(){
    //irrelevant functions have been omitted

    $("#smsMessage").charCount({
        allowed:110,        
        warning:10, 
    });
    $('form').validate();
});

I even tried re-firing the counter function, as a callback to the validation, but that just resulted in a duplicate, non-functional counter being placed next to the textarea.

$(function(){
    //irrelevant functions have been omitted

    $("#smsMessage").charCount({
        allowed:110,        
        warning:10, 
    });
    $('form').validate({
        invalidHandler: function(form, validator) {
            var errors = validator.numberOfInvalids();
            if (errors) {
                $("#smsMessage").charCount({
                    allowed:110,        
                    warning:10, 
                });
            }
        }
    });
});

Admittedly, this is my first solo webDev project in a while — it’s for my fiancee and my wedding site, so I’m trying to class it up a bit. If there’s any way to have the counter and validation play nicely together, that would be great. If not, it’s not exactly the end of the world, but it’s still less than ideal.

  • 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-12T19:55:15+00:00Added an answer on June 12, 2026 at 7:55 pm

    The problem is that your counter plugin is not very smart about keeping track of where the counter is. It creates the counter by putting it after the text area. The validate plugin does the same thing with it’s error messages. The easiest fix will be to tell the validate plugin to put it’s errors somewhere else. Try this:

    $('form').validate({
        errorPlacement: function(error,element){
            if (element.attr('id') == 'smsMessage'){
                error.insertAfter(element.next());
            } else {
                error.insertAfter(element);
            }            
        }       
    });​
    

    I made a working example so you can try it out: http://jsfiddle.net/ryleyb/6HKuq/

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

Sidebar

Related Questions

After an extensive search I have been unable to find any information on this
This seems like a really easy problem however after extensive searching I can't seem
I have been searching around and it looks like this question has been asked
So after extensive research and tons of jQuery and Javascript solutions I simply could
After deploying WCF server (svc) on my Server, I have got this message when
I've been searching all day and found several similar issues, but none have resolved
Hello all! This is my first post on stackoverflow. After hours of searching and
I have been having a lot of troubles with Rails after upgrading to Mountain
After searching stackoverflow for an answer, I decided that the only problems that were
I know this have been asked a lot but I am still having the

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.