Skip to content

Instantly share code, notes, and snippets.

@nathanpc
Created September 3, 2011 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanpc/1191091 to your computer and use it in GitHub Desktop.
Save nathanpc/1191091 to your computer and use it in GitHub Desktop.
Field Character Counter
function textCounter(field, cntField, maxLimit) {
cntField.innerHTML = maxLimit - field.value.length;
if (field.value.length > 120) {
$("#label").css("color", "#ff0034");
} else if (field.value.length > 100) {
$("#label").css("color", "#ff6025");
} else {
$("#label").css("color", "#3e3e3e");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment