A Word & Character Counter App Developed with jQuery

Word counter is the minimum character counter that uses the split method and the length property to count the number of characters and words you type in a text field.

jquery character count, word count in jquery for textarea, textarea word count jquery plugin, how to count words in real time using jquery, word count validation in jquery

How to make use of it:

1. Create the HTML for the character and word counter.

<div class="output">
  <div>
    <h6>WORDS</h6>
    <h3 id="words">0</h3>
  </div>
  <div>
    <h6>CHARACTERS</h6>
    <h3 id="characters">0</h3>
  </div>
</div>

2. Load the newest jQuery library within the doc.

<script src="/path/to/cdn/jquery.slim.min.js"></script>

3. Apply the character and word counter to a textual content area inside the doc.

$(document).ready(function() {
  $("#toCount").on("input", function() {
    $("#characters").text(this.value.replace(/ /g,'').length);
    $("#words").text(this.value.trim().split(" ").filter((item) => item).length);
  });
});

Minimalist Character & Word Counter Plugin/Github, how to count string in jquery, count comma separated values in jquery


See Demo And Download

Official Website(Anita9771): Click Here

This superior jQuery/javascript plugin is developed by Anita9771. For extra Advanced Usages, please go to the official website.

Leave a Comment