首页 > 其他 > 详细

文本框限制字数输入无刷新提示

时间:2014-01-25 20:53:47      阅读:351      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
<script type="text/javascript">
        $(function(){
                    $("#input1").keyup(function(){
                        $(‘span‘).empty();
                        var txtlength=$(this).val().length;
                        var maxlength=20;
                        var    aa=maxlength-txtlength;
                        aa>0==true?    $(‘span‘).append("你还可以输"+aa+"汉字"):$(‘span‘).append("你不能再输入了!");
                    });
        });
    
    </script>
bubuko.com,布布扣
 <body>
    <input type="text" value="" id="input1" maxlength="20" /><span style="color:red"></span>
 </body>

小弟新手...请各位大神不吝赐教....

文本框限制字数输入无刷新提示

原文:http://www.cnblogs.com/dandanwozhishidan/p/3533383.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!