直接源码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>textarea</title>
<script type="text/javascript" src="http://libs.useso.com/js/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function limitTextarea(self,nowleng){
$(self).on('input propertychange', function(event) {
var _val = $(self).val();
_val = _val < 140 ? _val : _val.substr(0,140);
$(self).val(_val);
$(nowleng).text(_val.length)
});
$(self).blur(function(){
$(self).off('input propertychange');
});
}
</script>
</head>
<body>
<textarea maxlength="140" rows="5" class="form-control limit-textarea" onfocus="limitTextarea(this,'.state');"></textarea>
<p><span class="state">0</span>/140字</p>
</body>
</html>