Example 1 - (This is the default without any config)

Code used

There is no javascript configuration used in this example. By setting a maxlength property for the textarea, example:

<textarea name="myComment" id="myComment" maxLength="10" cols="50 rows="3">

and by including the dg-textarea-maxlength-autoload.js file,

<script type="text/javascript" src="js/dg-textarea-maxlength-autoload.js"></script>

you will get a default config for all textareas where the maxlength attribute is set

Example 2 : Manual config

Code used:

var maxLength = new DG.TextareaMaxlength( {
	el : 'poem',
	statusEl : 'poem-maxlength-status',
	maxLength : 255,
	statusText : '{0} of maximum {1} characters'