X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/0cc5f179bae5cb1df6f18cf1397ad56b6504b060..d63190b067ddbf6beb150c924b3efe2f4c67c85e:/wtem/static/wtem/wtem.js diff --git a/wtem/static/wtem/wtem.js b/wtem/static/wtem/wtem.js index fe04ba6..a65bb7f 100644 --- a/wtem/static/wtem/wtem.js +++ b/wtem/static/wtem/wtem.js @@ -2,7 +2,7 @@ $(function() { var to_submit; - $('#submit_answers').click(function(e) { + $('form').submit(function(e) { //e.preventDefault(); to_submit = {}; @@ -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