From 5a60877f590a9e170ad905efe0b2062c16426ae5 Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Tue, 5 Mar 2013 17:12:52 -0600 Subject: [PATCH] update docs to include preprocessTag method --- README.markdown | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index be70e81d..e541e028 100644 --- a/README.markdown +++ b/README.markdown @@ -78,7 +78,7 @@ Defaults to an empty array *[]*. ### autocomplete (Object) Allows overriding the `source` and `select` options that are set by default, -as well as adding any other options you want to pass to the jQuery UI Autocomplete widget, such as `minLength` or `delay`. +as well as adding any other options you want to pass to the jQuery UI Autocomplete widget, such as `minLength` or `delay`. The `autocomplete.source` should be overridden if you want to use custom autocompletion sources, like an Ajax / XHR response. @@ -134,7 +134,7 @@ Defaults to *false*. ### tagLimit (integer) Limits the total number of tags that can be entered at once. Note that if you use this option with preloaded data, -it may truncate the number of preloaded tags. Set to `null` for unlimited tags. See the **onTagLimitExceeded** +it may truncate the number of preloaded tags. Set to `null` for unlimited tags. See the **onTagLimitExceeded** callback for customizing this behavior. Defaults to *null*. @@ -253,6 +253,17 @@ Adds new tag to the list. The `additionalClass` parameter is an optional way to $("#myTags").tagit("createTag", "brand-new-tag"); +### preprocessTag(function, Callback) +Set a function to be called before tag is created. Callback receives the +value of the tag created. + + // ensure all tags are capitalized + $(#tag-it").tagit("preprocessTag", function(val) { + if (!val) { return ''; } + return val[0].toUpperCase() + val.slice(1, val.length); + }); + // foo -> Foo + ### removeTagByLabel(tagLabel, animate) Finds the tag with the label `tagLabel` and removes it. If no such tag is found, it'll throw an exception.