X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Fviews%2Fvideo%2Fcomments_view.php;h=f2b4145a656b5f304f0060125982d50d243453a3;hb=2881d1393f363efd3c5f0e9b58706e6e35e85717;hp=80f56fd4db9800cdf52c35173bb4c9492727358b;hpb=480a21049384e47afe920e73972ca336ec8e6a54;p=living-lab-site.git diff --git a/application/views/video/comments_view.php b/application/views/video/comments_view.php index 80f56fd..f2b4145 100644 --- a/application/views/video/comments_view.php +++ b/application/views/video/comments_view.php @@ -60,7 +60,7 @@ function updateCommentCharsLeft($textarea) { - $('#comment-chars-left').html('' + (512 - $textarea.val().length)); + } $(function() { @@ -71,6 +71,7 @@ function(data) { $('#video-comments').html(data); }); + $('#comment').val(''); }); $('.pagination') @@ -126,14 +127,14 @@ }); $('#comment') - .keydown(function(event) { - updateCommentCharsLeft($(this)); + .bind('keyup paste drop change', function(event) { + $textarea = $(this); - if ($(this).val().length == 513) - $(this).val($(this).val().substring(0, 512)); - }) - .change(function() { - updateCommentCharsLeft($(this)); + if ($textarea.val().length >= 513) + $textarea.val($textarea.val().substring(0, 512)); + + $('#comment-chars-left').html('' + (512 - $textarea.val().length)); + console.log(event.type); }); }); \ No newline at end of file