Limit the max characters allowed in comments

No one is writing War and Peace in this comment field!

Are your readers writing their own version of War and Peace in your comments? Paste the below tidbit of JavaScript in Settings > Style > Custom HTML > Article to set a maximum number of characters allowed in the text area. 

    //Set character limit on comments
    var maxchars = 300; //Change this number to change the character limit
    $('.hg-comment-post textarea').before('<div class="text-right"><span id="remain">'+maxchars+'</span> characters remaining</div>');
    $('.hg-comment-post textarea').keyup(function () {
         var tlength = $(this).val().length;
         $(this).val($(this).val().substring(0, maxchars));
         var tlength = $(this).val().length;
         remain = maxchars - parseInt(tlength);

Readers will be shown the maximum character count and it will count down as they type. They will not be able to type more than the allowed characters. It even works with copy and paste!

We've added the code to this page so you can see it in action. We set a limit of 140 characters so if you can't tweet it, it won't fit in a comment!