Appends a character countdown to input fields, showing the characters left until maxlength is reached.
Try the jsfiddle demo to see it live!
<div>
<input type="text" maxlength="120" />
</div>
<!-- Adjust the path to your bootstrap-maxlength.js copy -->
<script src="/js/bootstrap-maxlength/bootstrap-maxlength.js"></script>
<!-- Apply maxlength() on all input fields which have a maxlength attribute -->
<script>
$(document).ready(function() {
$("input[maxlength]").maxlength();
});
</script>
Simply download a zipped release, unpack it, then add the bootstrap-maxlength.js
file to your project.
Add the package bootstrap-maxlength-simple
to your bower.json project file.
{
"name": "My Project",
"dependencies": {
"bootstrap-maxlength-simple": "3.*"
}
}
See 2.0 branch for a version which is compatible with Twitter Bootstrap 2.