Textarea with character count

Bootstrap snippet. Textarea with character count, this snippet was created to help web designers,
front-end developers and back-end developer save time. Use it in your project and build your app faster,
You can also download the HTML, CSS, and JS code.
tags: count,validation,form

HTML code

Copy, paste, change, customize and run the following HTML code to get a result like the one shown in the preview selection

<div class="col-sm-4 well">
    <form accept-charset="UTF-8" action="" method="POST">
        <textarea class="form-control" id="text" name="text" placeholder="Type in your message" rows="5"></textarea>
        <h6 class="pull-right" id="count_message"></h6>
        <button class="btn btn-info" type="submit">Post New Message</button>
    </form>
</div>

CSS code

Copy, paste, change, customize and run the following CSS code to get a result Like the one shown in the preview selection

#text {
    resize: none;
    margin-botton:10px;
}
                                    

Javascript/Jquery code

Copy, paste, change, customize and run the following JS code to get a result Like the one shown in the preview selection

var text_max = 200;
$('#count_message').html(text_max + ' remaining');
  $('#text').keyup(function() {
  var text_length = $('#text').val().length;
  var text_remaining = text_max - text_length;
  $('#count_message').html(text_remaining + ' remaining');
}); 

Similar snippets

Bootstrap snippet bs4 signup form

bs4 signup form

View

Bootstrap snippet Edit profile page

Edit profile page

View

Bootstrap snippet Blog Comments With Form

Blog Comments With Form

View

About this snippet

Creator: Dey Dey

Bootstrap version: 3.1.1

Created: Jun 1st 2014, 19:45

Views: 4.0K

Rated 5/5 based on 4 reviews