diff options
author | neilmonroe <neil.monroe@gmail.com> | 2009-03-20 14:49:10 -0700 |
---|---|---|
committer | neilmonroe <neil.monroe@gmail.com> | 2009-03-20 14:49:10 -0700 |
commit | f2970f0e62d56c8f985bbcdaf3f803f9739c5daa (patch) | |
tree | 2ed9fd1f981ddc67cb8f66bf9e9f47c8c553f75b | |
parent | 465a6a365b0254ef4ee06e329881a14f791c12c4 (diff) | |
download | jquery-countable-f2970f0e62d56c8f985bbcdaf3f803f9739c5daa.zip jquery-countable-f2970f0e62d56c8f985bbcdaf3f803f9739c5daa.tar.gz jquery-countable-f2970f0e62d56c8f985bbcdaf3f803f9739c5daa.tar.bz2 |
Update markdown formatting.
-rw-r--r-- | README.markdown | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/README.markdown b/README.markdown index aba97a6..1d8cf08 100644 --- a/README.markdown +++ b/README.markdown @@ -5,50 +5,44 @@ A jQuery plugin that adds a character counter to inputs and textareas. ## Settings -The countable plugin has 11 settings: +The countable plugin has 12 settings: -* `threshold` - The percentage at which the counter begins to fade in. Default is 0.5. -* `appendMethod` - One of `insertAfter`, `insertBefore`, `prependTo`, or `appendTo` to insert the counter after or before the input/textarea or prepend or append to the `target` element. Default is `insertAfter`. +* `threshold` - The percentage at which the counter begins to fade in. Default is `0.5`. +* `appendMethod` - One of `insertAfter`, `insertBefore`, `prependTo`, or `appendTo` to insert the counter after or before the input/textarea or prepend or append to the `target` element. Default is `'insertAfter'`. * `target` - Container element into which to place the counter -* `startOpacity` - The percentage of opacity it should start out with once it reaches the threshold. Default is 0.25. +* `startOpacity` - The percentage of opacity it should start out with once it reaches the threshold. Default is `0.25`. * `maxLength` - The maximum number of characters. Default uses the `maxlength` attribute of the input/textarea. -* `maxClassName` - The class name to add once the user has gone over the max number of characters. Default is 'maxed'. -* `className` - The class name for the counter. Default is 'counter'. +* `maxClassName` - The class name to add once the user has gone over the max number of characters. Default is `'maxed'`. +* `className` - The class name for the counter. Default is `'counter'`. * `tagName` - The type of tag to use for the counter. Default is `span`. -* `interval` - The interval at which it checks the input/textarea. Default is 750. -* `positiveCopy` - The copy to use when the character count is below the max. Use `{n}` to denote where the number should go. Default is "You have {n} characters left.". -* `negativeCopy` - The copy to use when the character count is over the max. Use `{n}` to denote where the number should go. Default is "You are {n} characters over.". -* `fadeDuration` - The duration of the fade animations. Default is 'normal'. +* `interval` - The interval at which it checks the input/textarea. Default is `750`. +* `positiveCopy` - The copy to use when the character count is below the max. Use `{n}` to denote where the number should go. Default is `"You have {n} characters left."`. +* `negativeCopy` - The copy to use when the character count is over the max. Use `{n}` to denote where the number should go. Default is `"You are {n} characters over."`. +* `fadeDuration` - The duration of the fade animations. Default is `'normal'`. ## Examples Add counter to all textarea objects on the page using defaults: -{ - $("textarea").countable(); -} +`$("textarea").countable();` Add counters to a specific set of text fields, before each element: -{ - $("#myTextBox, textarea.info").countable({ appendMethod: "insertBefore" }); -} +`$("#myTextBox, textarea.info").countable({ appendMethod: "insertBefore" });` Add counter to a specific textarea, but display in a given container element (with other advanced options): -{ - $("#comments").each(function() { - $(this).countable({ - threshold: .75, - appendMethod: "appendTo", - target: $(this).parent().find("label small"), - startOpacity: 1, - maxLength: $(this).metadata().maxLength, - positiveCopy: " ({n} characters left)", - negativeCopy: " ({n} characters over the limit)", - fadeDuration: 0 - }) - }); -} - -Note: In the last example, the code is wrapped in an 'each' function call to get 'this' to point to the text element. Also, 'maxLength' is being pulled from contextual information using the metadata jQuery plugin (http://plugins.jquery.com/project/metadata). +`$("#comments").each(function() { + $(this).countable({ + threshold: .75, + appendMethod: "appendTo", + target: $(this).parent().find("label small"), + startOpacity: 1, + maxLength: $(this).metadata().maxLength, + positiveCopy: " ({n} characters left)", + negativeCopy: " ({n} characters over the limit)", + fadeDuration: 0 + }) +});` + +_Note: In the last example, the code is wrapped in an `each` function call to get `this` to point to the text element. Also, `maxLength` is being pulled from contextual information using the metadata jQuery plugin (<http://plugins.jquery.com/project/metadata>)._ ## License |