Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

character remaining count

Posted on 2014-02-14
1
Medium Priority
?
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 2000 total points
ID: 39859983
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 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