码迷,mamicode.com
首页 > Web开发 > 详细

微博发布框的jquery

时间:2015-05-26 12:49:10      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:jquery

<style type="text/css">
textarea{
    width: 300px;
    height: 300px;
    border: solid 1px #abcdef;
}
strong{
    color: red;
}
</style>
</head>
<body>
<textarea></textarea>
<p>你还可以输入<strong>140</strong>个字</p>
<script type="text/javascript">
    $("textarea").keydown(function(){
        var max=140;
        var tianzi=max-$("textarea").val().length;
        $("strong").text(tianzi);
        if($("strong").text()<=0){
            $("strong").text("0");
            var val=$("textarea").val().substring(0, 140);
            $("textarea").val(val);
        }
    });
</script>
</body>

微博发布框的jquery

标签:jquery

原文地址:http://blog.csdn.net/u011263845/article/details/46004859

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!