I'm building a CMS and I'd like to have my Bootstrap Tags Input require a minimum of 6 tags as well as count the number of tags and display it on a counter, like this:
<input type="text" data-role="tagsinput" placeholder="Add some tags!" id="tags" required>
<label for="tags">You must enter at least 6 tags. You have added <span id="tag-count">0</span> tags.</label>
input#tags
will hold the tags, and the span#tag-count
will display the number of tags.
How do I do this with JavaScript or jQuery?
From the docs, I'd say you can compute the count quite easily.
For instance using jQuery:
To update your count text, you can use: