Solved

character remaining count

Posted on 2014-02-14
1
222 Views
Last Modified: 2014-03-10
I want to display character remaining count when a user start typing. lblcommentscount is displayed 512 when txtbox is empty. How can I prevent this? Instead it should be displayed only when a user start typing.




<script type="text/javascript">
  
     function countCharacters(textbox, label, maxcount) {
        var count = parseInt(document.getElementById(textbox).value.length);
        document.getElementById(label).innerHTML = maxcount - count;
    }


 

 txtcomments.Attributes.Add("onKeyUp", String.Format("countCharacters('{0}','{1}', 512) ", txtcomments.ClientID, lblcommentscount.ClientID))

Open in new window

0
Comment
Question by:VBdotnet2005
1 Comment
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 500 total points
Comment Utility
Make the element not visible on the page and on each keystroke make it visible. Alternatively you could make it visible when the textbox gets focus, but that isn't exactly the requirement you specified.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now