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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:36:51+00:00 2026-06-15T22:36:51+00:00

I added a word counter to a my form’s textarea… it is something like

  • 0

I added a word counter to a my form’s textarea… it is something like this…

<div>
  <label>About you:</label>
  <textarea id="qualification" class="textarea hint_needed" rows="4" cols="30" ></textarea>                     
  <span class="hint">explain about you</span>
  <script type="text/javascript">
    $("textarea").textareaCounter();
  </script>
</div>

My problem is when I add textaracounter() like this my validation hint is not working.. when I remover the counter function validation hint is working…

this is the jquery for hint message..

$(".hint").css({ "display":"none" });
$("input.hint_needed, select.hint_needed, textarea.hint_needed, radio.hint_needed").on("mouseenter", function() {
$(this).next(".hint").css({ "display":"inline" });
}).on("mouseleave", function() {
$(this).next(".hint").css({ "display":"none" });
});

this is for the word counter..

(function($){
    $.fn.textareaCounter = function(options) {
        // setting the defaults
        // $("textarea").textareaCounter({ limit: 100 });
        var defaults = {
            limit: 150
        };  
        var options = $.extend(defaults, options);

        // and the plugin begins
        return this.each(function() {
            var obj, text, wordcount, limited;

            obj = $("#experience");
            obj.after('<span style="font-weight: bold; color:#6a6a6a; clear: both; margin: 3px 0 0 150px; float: left; overflow: hidden;" id="counter-text">Max. '+options.limit+' words</span>');

            obj.keyup(function() {
                text = obj.val();
                if(text === "") {
                    wordcount = 0;
                } else {
                    wordcount = $.trim(text).split(" ").length;
                }
                if(wordcount > options.limit) {
                    $("#counter-text").html('<span style="color: #DD0000;">0 words left</span>');
                    limited = $.trim(text).split(" ", options.limit);
                    limited = limited.join(" ");
                    $(this).val(limited);
                } else {
                    $("#counter-text").html((options.limit - wordcount)+' words left');
                } 
            });
        });
    };
})(jQuery);

can anybody tell me what is the problem there?

Thank you..

  • 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-15T22:36:52+00:00Added an answer on June 15, 2026 at 10:36 pm

    http://jsfiddle.net/QD3Hn/14/ // without improvements

    (function($){
        $.fn.textareaCounter = function(options) {
            // setting the defaults
            // $("textarea").textareaCounter({ limit: 100 });
            var defaults = {
                limit: 150
            };  
            var options = $.extend(defaults, options);
    
            // and the plugin begins
            return this.each(function() {
                var obj, text, wordcount, limited;
    
                obj = $(this);
                obj.next(".hint").after('<span style="font-weight: bold; color:#6a6a6a; clear: both; margin: 3px 0 0 150px; float: left; overflow: hidden;" id="counter-text">Max. '+options.limit+' words</span>');
    
                obj.on("keyup keydown", function() {
                    text = obj.val();
                    if(text === "") {
                        wordcount = 0;
                    } else {
                        wordcount = obj.val().split(" ").length;
                    }
                    if(wordcount == options.limit) {
                        obj.next(".hint").next("#counter-text").html('<span style="color: #DD0000;">0 words left</span>');
                        limited = $.trim(text).split(" ", options.limit);
                        limited = limited.join(" ");
                        $(this).val(limited);
                    } else {
                        obj.next(".hint").next("#counter-text").html((options.limit - wordcount)+' words left');
                    } 
                });
            });
        };
    })(jQuery);
    $(document).ready( function() {
        $(".hint").css({ "display":"none" });
        $("input.hint_needed, select.hint_needed, textarea.hint_needed, radio.hint_needed").on("mouseenter", function() {
        $(this).next(".hint").css({ "display":"inline" });
        }).on("mouseleave", function() {
        $(this).next(".hint").css({ "display":"none" });
        });
            $("textarea").textareaCounter();
        });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my code I have added this variable var spellSpace = $('td[data-word=' + listOfWords[rndWord].name
How can I develope word Art effect functinality for run time added test (Like
I accidentally added a word I'm forever mis-spelling into Eclipse's spell-checker dictionary. How do
I just added a new Word AddIn project to my blank solution and just
I'm developing my first Word 2007 addin, and I've added an OfficeRibbon to my
I build up a Office 2010 Word Add In, added a Windows Forms Element
I added a configuration variable in application.rb such as module Www class Application <
Currently i have a word document with comments added. The structure of the document
This is a bit of a difficult problem for me to word, and I
I have added a class to all of the td's associated with my table.

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.