Home > php教程 > php手册 > jQuery检测文本框中的输入字符数

jQuery检测文本框中的输入字符数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 11:43:22
Original
1353 people have browsed it

jQuery检测文本框中的输入字符数,显示还可以输入多少字符
<title>字数限制</title> <br> <style><br /> *{font-size:12px;}<br /> .word{color:#FF3333;}<br /> textarea{width:200px; height:40px;}<br /> </style> <br> <script></script><br> <br> 还可以输入<span>40</span>个字<br><br> <textarea></textarea><br> <script><br /> $("#txt").keyup(function(){ <br /> if($("#txt").val().length > 40){<br /> $("#txt").val( $("#txt").val().substring(0,40) );<br /> }<br /> $("#word").text( 40 - $("#txt").val().length ) ;<br /> });<br /> </script><br>

附件 jQuery_Text.zip ( 572 B 下载:35 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

Statement of this Website
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
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template