diff --git a/README.markdown b/README.markdown index c2a16ba5..77b3b1c7 100644 --- a/README.markdown +++ b/README.markdown @@ -167,6 +167,11 @@ Optionally set a *placeholder* attribute on the `input` that gets created for ta Defaults to *null* +### maxTagLength (integer) +Optionally set a *maxlength* attribute on the tag-it `input` that gets created. + +Defaults to *null* + ## Events diff --git a/js/tag-it.js b/js/tag-it.js index 078c264f..15e145aa 100644 --- a/js/tag-it.js +++ b/js/tag-it.js @@ -94,6 +94,9 @@ onTagClicked : null, onTagLimitExceeded : null, + // Optionally set a maxlength attribute on the tag-it input + maxTagLength: null, + // DEPRECATED: // @@ -136,6 +139,10 @@ this.tagInput.attr('placeholder', this.options.placeholderText); } + if (this.options.maxTagLength) { + this.tagInput.attr('maxlength', this.options.maxTagLength); + } + if (!this.options.autocomplete.source) { this.options.autocomplete.source = function(search, showChoices) { var filter = search.term.toLowerCase();