Learn jquery today, do exercises calculate the HTML tag textarea character length, first add a View action (action):
Create a view and mark it in the following order to write HTML or JavaScript scripts:
Where the detailed script for marker 3 is:
Demo Look:
In fact, we calculate the number of characters, generally do not apply this way, but because of the restriction of the character length, just add such a function, let the user know how many numbers are currently entered.
Let's change the program again:
Demonstrate:
This calculation requires the user to click on the "Calc" ammonium button, whether it can be calculated in real time?
No problem, use the KeyUp () method. Change the program to see:
Remove the tag 1~6 code and add the tag 7~13 code. Demonstrate:
So far, the program just did the calculation and hints, but more than the length of the user can still input, whether you can enter the limit of the long sequence, to terminate user input or to truncate the extra long characters?
Insus.net re-Modify the program:
Demonstrate:
2014-06-06 09:00 Add the following:
MVC series Exercises, the latest source programs and databases, can be downloaded from the link below.
Http://download.cnblogs.com/insus/MVC/InsusMVCSiteCS_20140606.rar