Bootstrap snippet: Textarea with character count

designed to help people of all skill levels - designer or developer, huge nerd or early beginner.
copy and paste the code. Use it as a complete kit or use it to start something more complex.
tags: count,validation,form



<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>
#text { resize: none; margin-botton:10px; }
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'); });
Dey-Dey

Textarea with character count

Dey-Dey
  Jun 11th 2014, 00:18
2.4K Views