hailwood / jQuery-Tagit

The Jquery Tagit Plugin transforms an html unordered list into a unique tagging plugin.
264 stars 109 forks source link

"maxTags" invalid when leave focus to add a tag. #85

Open wudiipdang opened 11 years ago

ianbailey commented 11 years ago

You can fix this by editing row 270

if (self.options.allowNewTags) { }

At the minute, if allowNewTags is true, it'll add the tag regardless if self.options.maxTags has been hit or not.

I've edited it to the following:

if (!self.options.allowNewTags || (self.options.maxTags !== undefined && self.tagsArray.length == self.options.maxTags)) { 
}
else if (self.options.allowNewTags && $(this).val().length >= self.options.minLength) {
}

Which is a copy+paste of some code further up in the file.

HTH