Calculate the length of Characters in the html Tag textarea.

Source: Internet
Author: User

Today, I learned about jQuery and used the exercises to calculate the length of the html Tag textarea. First, I added a view operation (Action ):



Create a view and mark 1, 2, 3 in the following order to write html or javascript scripts:



Detailed script marked with 3:


Demo:



In fact, we generally do not apply this function when calculating character numbers. Instead, we add such a function because of the limited length of characters to let users know how many numbers have been entered.
Let's change the program:



Demo:


This computation requires the user to click the "calc" button. Can it be computed in real time?

No problem. Use the Keyup () method. Change the program to see:


Delete mark 1 ~ 6. Add the tag ~ 13 code. Demo:

 


So far, the program only implements computation and prompt, but beyond the length, the user can still enter, can enter to the long order after the limit, end user input or cut off too long characters?

Insus. NET and then modify the program:

 

Demo:


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.