Just include text-control.js after jQuery. Requires jQuery 1.4+.
It is also available via bower.
$ bower install --save text-control
<script src='jquery.js'></script>
<script src='text-control.js'></script>
$('.foo').texControl();
To make the script run when the page load, you need to put the "shiny" inside a load, ready function or in the end of the , like this:
$(document).ready(function(){
$('.foo').textControl();
})
$('.foo').textControl({
limit: 26
});
You can set the character limit! Easy and done.
If this plugin was usefull to you, please send me a tweet (@marcuscaum)! We are open to receive any ideas to make this plugin better every day.