/majTextCounter

A simple plugin to count and limit caracters/words on input and textarea

Primary LanguageJavaScriptMIT LicenseMIT

maj Text Counter Plugin

A jQuery plugin for counting and limiting characters/words on text input, or textarea, elements (using .val()).

Installation

Include script after the jQuery library:

<script src="/javascripts/maj-text-counter.js"></script>

Usage

Basic usage:

$('input').majTextCounter();

Limit to a maximum words count:

$('input').majTextCounter({
	wordLimit: 10,
});

Limit to a maximum caracters count:

$('input').majTextCounter({
	carLimit: 10,
});

Speak french ?:

$('input').majTextCounter({
    words: "mots",
    letters: "lettres",
    separator: " & ",
    maximum: "MAX :",
});

Elements

By default the plugin add the following element after the input/textarea:

<span class="maj-text-counter">2 words | 14 letters</span>

Development

Authors

miseajour.net