summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jquery.countable.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/jquery.countable.js b/jquery.countable.js
index fb0b569..1098642 100644
--- a/jquery.countable.js
+++ b/jquery.countable.js
@@ -10,10 +10,11 @@ $.fn.extend({
return this.each(function() {
var $this = $(this), interval, prev_char_diff, $el;
options = $.extend({
- threshold: 0.5,
- appendMethod: 'insertAfter', // insertBefore || insertAfter
+ threshold: .5,
+ appendMethod: 'insertAfter', // insertBefore || insertAfter || prependTo || appendTo
+ target: $this, // element in which to place the counter
startOpacity: .25,
- maxLength: parseInt( $this.attr('maxlength'), 10 ),
+ maxLength: parseInt( $this.attr('maxlength'), 10 ) || 0,
maxClassName: 'maxed',
className: 'counter',
tagName: 'span',
@@ -27,7 +28,7 @@ $.fn.extend({
.html( options.positiveCopy.replace("{n}", '<span class="num"/>') )
.addClass( options.className );
if ( $.support.opacity ) $el.css({ opacity: 0 }); // don't set opacity for IE to avoid clear text issues.
- $el[options.appendMethod]($this);
+ $el[options.appendMethod](options.target);
$this
.bind('keyup', check)