live character count meter error
I found the code below while I was searching for live character count
meter, but it does not work for me. I do not know what is the problem.
$(document).ready(function() {
$("#contentbox").keyup(function() {
var box=$(this).val();
var count= 300 - box.length;
if(box.length <= 300) { $("#count").html(count);
} else {
var trimmed = $(this).val().substring(0,300);
$(this).val(trimmed);
}
});
});
Any idea?
No comments:
Post a Comment