Text box word limit function jquery plug-in_jquery
WBOY
Release: 2016-05-16 18:41:15
Original
1127 people have browsed it
Later, when I was wandering around on the Internet, I suddenly found a better jquery plugin with character limit for text boxes. It is simple and easy to use. >Copy code
data-maxsize: the The maximum number of words that the text field can accept. (important) data-output: If you want to dynamically display the number of words in the text box in real time, this attribute sets the ID of the span or div that displays the number of words. (The color of the word number display will change with the number. Change) If you do not modify its source file, after adding the js reference, you only need to add the data-maxsize attribute to your text or textarea. About dynamically setting the maximum value Use the setformfieldsize method:
setformfieldsize($field, maxsize, outputfieldid) Attribute explanation: $field: is the JQuery object of the restricted text box (reference Jquery document). maxsize: Same as data-maxsize, the maximum number of words that the text field can accept. outputfieldid: Same as data-output. Example:
Copy code
The code is as follows:
Executed when the interface is loaded. Demo code download http://xiazai.jb51.net/200911/yuanma/textarea_maxlength.rar
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn