Home  >  Article  >  Web Front-end  >  js实时计算字数提醒的文本框_表单特效

js实时计算字数提醒的文本框_表单特效

WBOY
WBOYOriginal
2016-05-16 18:23:341370browse

自己想了一下应该是用JavaScript实现的,今天把它做出来了。原理很简单就是根据文本框触发的onkeyup事件来获得当前文本框字符的长度,然后文本框允许输入的最大字符数来减去当前的字符数,并用label控件显示出来就可以了。
效果图:
js实时计算字数提醒的文本框_表单特效
演示代码:

Statement:
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
Previous article:jQuery基础知识filter()和find()实例说明_jqueryNext article:jQuery中filter(),not(),split()使用方法_jquery

Related articles

See more