diff --git a/file/js/jCounter.jQuery.coffee b/file/js/jCounter.jQuery.coffee index bc30d03..591d8d6 100644 --- a/file/js/jCounter.jQuery.coffee +++ b/file/js/jCounter.jQuery.coffee @@ -7,28 +7,38 @@ # @package jQuery.jCounter ### (($) -> - $.fn.jCounter = (max, options) -> - max ?= 140 + $.fn.jCounter = (container, options) -> options = $.extend - container: '' + max: 0 counterClass: 'counter' countUp: false , options - jCounterContainer = $ options.container + if this.attr('maxlength') + max = this.attr('maxlength') + else max = options.max - this.on 'keypress keydown keyup', $.proxy () -> + if !container + this.wrap('