summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-01 14:30:16 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-01 14:30:16 -0400
commit409bc56ff2379bac62d9073484ea8e7be2af0b14 (patch)
tree3982c28ff553ff2a67896fb49ed0999abb9794da
parent74e7dd253cf503e48027b1f98e06f1d12c586462 (diff)
run the counter once at page load time0.4.0
darcs-hash:20080701183016-84dde-f1aed06f7bd67a665ba55c03f036d98bd208c3b9.gz
-rw-r--r--js/util.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/js/util.js b/js/util.js
index 7eae496fd..4f2e7c724 100644
--- a/js/util.js
+++ b/js/util.js
@@ -1,7 +1,7 @@
$(document).ready(function(){
// count character on keyup
- function counter(){
- var maxLength = 140;
+ function counter(){
+ var maxLength = 140;
var currentLength = $("#status_textarea").val().length;
var remaining = 140 - currentLength;
var counter = $("#counter");
@@ -16,7 +16,8 @@ $(document).ready(function(){
if ($("#status_textarea").length) {
$("#status_textarea").bind("keyup", counter);
+ // run once in case there's something in there
+ counter();
}
-
});