html:
<textarea id="summary" rows="" cols="" placeholder="请输入本月今日工作总结" maxlength="500"></textarea> <div class="day_summary_today" id="count_summary">0/500</div>
js代码
$('#summary').bind('input propertychange','textarea',function(){
var content = $("#summary").val();
var n = content.length;
if(n > 500){
$("#summary").val()= $("#summary").val().substring(0, 500);
}else{
$("#count_summary").html(n+'/500');
}
});
注:'input propertychange'必须有