From 57a7aad192ec430d8037cbf3807b91eff3618642 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Sun, 28 Oct 2012 16:51:34 -0400 Subject: [PATCH] added input, cut, and paste to textarea messages Was using keyup to know when to update the "how many characters do you have" display. Keyup misses context menu cut/paste/undo/redo and drag & drop changes to the textarea contents. I added input which workes in new browsers to handle all of these. keyup, cut, and paste works in most other browser as fallback. http://jsfiddle.net/M2qsa/222/ I had to read up on all this myself here: http://whattheheadsaid.com/2010/09/effectively-detecting-user-input-in-javascript (they do even more which I don't understand so don't use) --- media/js/feedback.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/js/feedback.js b/media/js/feedback.js index 065044e1..6ed7ee80 100644 --- a/media/js/feedback.js +++ b/media/js/feedback.js @@ -137,7 +137,7 @@ $('article textarea').each(function(i, element) { countRemaining(element); }); - $('article textarea').live('keyup', function(e) { + $('article textarea').live('input keyup cut paste', function(e) { countRemaining(this); });