Textarea Character/Line Count And Limit Plugin - jQuery textArea.js

Textarea Character/Line Count And Limit Plugin - jQuery textArea.js

textArea.js is a jQuery plugin that adds live-updating character and line counters to your textarea element, as well as limiting the max number of characters and lines to be entered with a progress bar. Compatible with Bootstrap framwork.

1. Create a character countdown progress bar to display how many characters left until max length is reached.

<div class="progress">
  <div id="progress-percent" class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
    <span id="progPercentage" class = "current-value">0</span>

2. Create character and line counters.

<div class = "count"><span id="charCount">0</span> Char</div>
<div class = "count"><span id="lineCount">1</span> Lines</div>

3. Import jQuery library and the jQuery textArea.js script into the web page.

<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="jquery.textArea.js"></script>

4. Enable the plugin on the target textarea and done.

  // CSS selectors
  // max number of characters
  // max number of lines
  // how many character per line

This awesome jQuery plugin is developed by harisouras. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 26.11.2017
  • Source