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: