From 95c49edc70ea8c6f69cd0b491e0e64b8eca6d128 Mon Sep 17 00:00:00 2001 From: Jay Nielson Date: Tue, 19 May 2015 18:28:39 +1200 Subject: [PATCH] Added two new functions to update the count Added the "nobleCount.Update" event so the character count can be updated externally to the plugin Added the paste event so the character count can be updated when a paste event occurs --- js/jquery.NobleCount.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/js/jquery.NobleCount.js b/js/jquery.NobleCount.js index 5ccecb8..fb9eaec 100644 --- a/js/jquery.NobleCount.js +++ b/js/jquery.NobleCount.js @@ -299,6 +299,28 @@ return false; } }); + + //Allow updating the count externally to the plugin + $(t_obj).on("nobleCount.Update", function (e) { + event_internals(t_obj, char_area, c_settings, max_char, false); + + // to block text entry, return false + if (check_block_negative(e, t_obj, c_settings, max_char) == false) { + return false; + } + }); + + //Make sure to include the paste event as well + $(t_obj).on("paste", function (e) { + setTimeout(function () { + event_internals(t_obj, char_area, c_settings, max_char, false); + + // to block text entry, return false + if (check_block_negative(e, t_obj, c_settings, max_char) == false) { + return false; + } + }, 100); + }); }