From 9e7682fab1de6a244a1662d4ae09abd56edf3666 Mon Sep 17 00:00:00 2001 From: cblanc Date: Sat, 9 May 2015 16:36:50 +0100 Subject: [PATCH] Listen on both keyup and change events --- app/assets/javascripts/shoutbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/shoutbox.js b/app/assets/javascripts/shoutbox.js index 4d511d8..447f966 100644 --- a/app/assets/javascripts/shoutbox.js +++ b/app/assets/javascripts/shoutbox.js @@ -20,7 +20,7 @@ ShoutboxController.prototype.init = function (options) { self.$input = self.$context.find(".shout_input"); self.$button = self.$context.find('input[type="submit"]'); self.$messageBox = null; - self.$input.change(function () { + self.$input.bind("keyup change", function () { if (self.$input.val().length > 100) { self.disableShoutbox(); } else { @@ -61,7 +61,7 @@ ShoutboxController.prototype.isDisabled = function () { // Disables Input Button ShoutboxController.prototype.disableShoutbox = function () { var chars = this.$input.val().length; - this.writeMessage(["Shout message length exceeded (",chars,"/100)"].join("")); + this.writeMessage(["Maximum shout length exceeded (",chars,"/100)"].join("")); this.$button.prop("disabled", true); };