[ eventually, something awesome will go here. ]

Archive for 'Code Snippets'

How To Add Maxlength To Jeditable

Just a snippet for anyone using the Jeditable Plugin, which enables editing-in-place functionality via jQuery, if you want to add “maxlength” controls to the fields.

  • in the jquery.jeditable.js file, add maxlength : ‘ ‘ to var settings={ }, around line 78
  • in the same file, add input.attr(’maxlength’, settings.maxlength); after input.attr(’name’, settings.name); which is around line 230
  • then in your main $(document).ready(function() { } ); add maxlength : ‘30′, or whatever value you want in the list of properties (indicator, type, tooltip, etc.)

That’s it. I had seen some pointers for this here, but I wanted to expand and add some clarity for all 12 people on the Internet who might be curious about this.

Posted on 15 March '09 by justin, under Code Snippets, Technology. No Comments.