Javascript maxlength validator
Include jQuery
Include maxlength.css
and maxlength.js
Give jQuery
element selector to new Maxlength
instance
<script type="text/javascript">
// for all inputs
new Maxlength('input');
// for text type inputs
new Maxlength('input[type=text]');
// for inputs which have maxlength attribute
new Maxlength('input[maxlength]');
// for specific input
new Maxlength('#inputId');
</script>
You can write your own css code inside --maxlength
class to change look