Skip to content

This is a Jquery plugin which uses maxlength attribute to restrict maximum number of characters allowed in the <input> <textarea> element. Also this plugin provides template for displaying the number of characters entered in the <input> <textarea> element.

License

Notifications You must be signed in to change notification settings

GururajNadager/jQuery-maxlength

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery-maxlength

This is a Jquery plugin which uses maxlength attribute to restrict maximum number of characters allowed in the <input> <textarea> element. Also this plugin provides template for displaying the number of characters entered in the <input> <textarea> element.

Configurable options

text: Text to be displayed in the template.
position: Text position in the template.
color: Color of the text displayed in the template.
fontSize: Size of the text displayed in the template.
template: container for the text displayed in the template.
showTemplate: Hide/show the template.

Examples

Basic implementation:
$("input,textarea").maxlength();

Configurable options:

$("input,textarea").maxlength({  
     text: "You have entered {total}/{maxLength}",  
     position: "left",
     color: "green",
     fontSize: "12px",
     template: "<div/>",
     showTemplate: true

});

Usage

<input type="text" maxlength="10" />

<textarea rows="4" cols="50" maxlength="50"></textarea>

<script type="text/javascript">

  $(document).ready(function () {
      $("input,textarea").maxlength();
   });
        
</script>

About

This is a Jquery plugin which uses maxlength attribute to restrict maximum number of characters allowed in the <input> <textarea> element. Also this plugin provides template for displaying the number of characters entered in the <input> <textarea> element.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published