I have this jQuery code:
我有这个jQuery代码:
var char = 60;
$("#counter").append("You have <strong>" + char + "</strong> char.");
$("#StatusEntry").keyup(function () {
if ($(this).val().length > char) {
$(this).val($(this).val().substr(0, char));
}
var rest = char - $(this).val().length;
$("#counter").html("You have <strong>" + rest + "</strong> char.");
if (rest <= 10) {
$("#counter").css("color", "#ff7777");
}
else {
$("#counter").css("color", "#111111");
}
});
var