X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/b524d9b88d918e6e3f34a3d56db57928653435db..d63190b067ddbf6beb150c924b3efe2f4c67c85e:/wtem/static/wtem/wtem.js diff --git a/wtem/static/wtem/wtem.js b/wtem/static/wtem/wtem.js index 1c61498..a65bb7f 100644 --- a/wtem/static/wtem/wtem.js +++ b/wtem/static/wtem/wtem.js @@ -56,4 +56,17 @@ $(function() { } } + var sms_handler = function() { + var textarea = $(this), + label_suffix = textarea.parent().find('.label_suffix'), + left = 140 - textarea.val().length; + to_insert = '(pozostało: ' + left + ')'; + if(left < 0) { + to_insert = '' + to_insert + ''; + } + label_suffix.html(to_insert); + }; + + $('#wtem_sms').change(sms_handler).keyup(sms_handler); + }); \ No newline at end of file