public
Description: jQuery edit in place plugin. Extendable via plugin architecture. Plugins for plugin. Really.
Homepage: http://www.appelsiini.net/projects/jeditable
Clone URL: git://github.com/tuupola/jquery_jeditable.git
jquery_jeditable / jquery.jeditable.charcounter.js
100644 39 lines (37 sloc) 1.098 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Charcounter textarea for Jeditable
*
* Copyright (c) 2008 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Depends on Charcounter jQuery plugin by Tom Deater
* http://www.tomdeater.com/jquery/character_counter/
*
* Project home:
* http://www.appelsiini.net/projects/jeditable
*
* Revision: $Id: jquery.jeditable.autogrow.js 344 2008-03-24 16:02:11Z tuupola $
*
*/
 
$.editable.addInputType('charcounter', {
    element : function(settings, original) {
        var textarea = $('<textarea />');
        if (settings.rows) {
            textarea.attr('rows', settings.rows);
        } else {
            textarea.height(settings.height);
        }
        if (settings.cols) {
            textarea.attr('cols', settings.cols);
        } else {
            textarea.width(settings.width);
        }
        $(this).append(textarea);
        return(textarea);
    },
    plugin : function(settings, original) {
        $('textarea', this).charCounter(settings.charcounter.characters, settings.charcounter);
    }
});