Today, the label of the form with a length limit, all the way input= "type" maxlength= "* *" down very smooth. At this time to kill a textarea, to give you add a maxlength.
But TextArea said to me: "elder brother I do not have this attribute, you see to change a bar ... "No way, ( now I use the FireFox15.0.1, Chrome25.0.1364.160 support this property ) since there is no such attribute then let's change it, with the event to control.
Online search, for monitoring the content of the text field can be used onchange, Onpropertychange, Oninput
Analysis:
OnChange is only triggered when the focus is lost, and if you use the JS method to manipulate the values in the Text field, the length limit we make is not valid.
Onpropertychange triggers when any property of a text field changes, including, of course, the change in value. With this seems possible, but this method of IE dedicated, in Google, Firefox and other browsers invalid.
Oninput for Google, Firefox and other standard browser, but the problem is that if you use JS to manipulate the values in the Text field, this event will not be triggered.
To sum up, what I can do now is to do the best:
1 <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 2
But "oninput applies to Google, Firefox and other standard browser, but there is a problem is if you use JS to manipulate the value of the text field when the event is not triggered" this problem or can not be solved, but also please pass the friend stop advice ....
Text field length limit