Configuration options

samuelchvez edited this page May 20, 2012 · 3 revisions
Clone this wiki locally

The initiation command for jQuery Tagger accepts a configuration object. This object accepts the following parameters:

separator {String}

This parameter tells the plugin what character will be used to try to generate the next tag. Default: ","

useColorFunction {Boolean}

Tells the plugin if the tags have to be colored according a colorFunction (described below). Default: true

colorFunction {Function}

This function receives as parameter the tag string and returns an object containing both, font color and background color as strings. Default: function(label){return {font:"#333", background:"#CCC"}}

startWith {Array}

Tells the plugin an array of tags that have to be placed when initiated. Default: []

closeChar {String}

Tells the plugin what char has to use in the close button for each tag. Default: "x"

tagClass {String}

Name of the CSS class to be applied to each tag (span element). Default: "tag"

taggerWrapperClass {String}

Name of the CSS class to be applied to the div that wraps the given input. Default: "tagger-input-container"

closeClass {String}

Name of the CSS class to be applied to the close component of each tag. Default: "close"

tagPlacedCallback {Function}

Function that receives as parameters the latest created tag and its string value. This function is called each time a tag is created. Default: function($tag, stag){}

tagRejectedCallback {Function}

Function that receives as parameters the input element and the tried tag's string value. This function is called each time a tag is rejected. Default: function($input, stag){}

acceptedTagRegex {RegExp}

Regular expression used to test each tag's string to check if it should be added as new tag. If this value is configured, the plugin omits the rejectedTagRegex (see below). Default: undefined

rejectedTagRegex {RegExp}

Regular expression used to test each tag's string to check if it should not be added as new tag. Default: undefined

limit {int}

Number that limits the amount of tags to be added.

width {String}

Style to be added after "width:" in the wrapper

limitReachedCallback {Function}

Callback function called after the tag limit is reached

oldInputPersistence {Boolean}

Tells the plugin if the actual input value is needed to be persisted. Default true.

oldInputPersistencePattern {String}

If oldInputPersistence is true, then the plugin uses this pattern to rename the current input name. In this string you can use the {old} wildcard to retrieve the current input original name. The default value of this configuration is "old_{old}"