我想在 js 中执行以下操作。有人知道怎么做吗?
http://s7.directupload.net/file/d/3361/587yctzg_jpg.htm
这是一个开始:http: //jsfiddle.net/HgfPU/10/
<textarea></textarea>
<strong>You have <em id="count"></em> characters remaining</strong>
<script>
maxCharacters = 160;
$('#count').text(maxCharacters);
$('textarea').bind('keyup keydown', function() {
var count = $('#count');
var characters = $(this).val().length;
if (characters > maxCharacters) {
count.addClass('over');
} else {
count.removeClass('over');
}
count.text(maxCharacters - characters);
});
</script>
谢谢!
更新
在这里找到了解决方案: