﻿jQuery.fn.maxlength = function(options) {
    
    var settings = jQuery.extend({
        maxChars: 1000 
    }, options);
    
    return this.each(function() {        
        var me = $(this);
        me.bind('keydown keypress keyup', function(e) {            
            if (me.val().length > settings.maxChars) me.val(me.val().substr(0, settings.maxChars));                        
        });
    });
};
