Sha256: ceabfb06932a720f34c2904de194b8258bff6c66eecbe9ad0cfc45c41c8f5745

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

/*
 *
 * Textarea Maxlength Setter JQuery Plugin
 * Version 1.0
 *
 * Copyright (c) 2008 Viral Patel
 * website : http://viralpatel.net/blogs
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
*/

jQuery.fn.maxlength = function(){

  $("textarea[maxlength]").keypress(function(event){
    var key = event.which;

    //all keys including return.
    if(key >= 33 || key == 13) {
      var maxLength = $(this).attr("maxlength");
      var length = this.value.length;
      if(length >= maxLength) {

        event.preventDefault();
      }
    }
  });

}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catarse_core-1.0.0.beta app/assets/javascripts/lib/jquery.maxlength.js