Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>first add custom options (maxTags and onlyAvailableTags) to the plugin file like so...</p> <pre><code>options: { itemName : 'item', fieldName : 'tags', availableTags : [], tagSource : null, removeConfirmation: false, caseSensitive : true, maxTags : 9999,//maximum tags allowed default almost unlimited onlyAvailableTags : false,//boolean, allows tags that are in availableTags or not allowSpaces: false, animate: true, singleField: false, singleFieldDelimiter: ',', singleFieldNode: null, tabIndex: null, onTagAdded : null, onTagRemoved: null, onTagClicked: null } </code></pre> <p>next replace the _isNew function with this one...</p> <pre><code>_isNew: function(value) { var that = this; var isNew = true; var count = 0; this.tagList.children('.tagit-choice').each(function(i) { count++; if (that._formatStr(value) == that._formatStr(that.tagLabel(this))|| count &gt;= that.options.maxTags) { isNew = false; return false; } if (that.options.onlyAvailableTags &amp;&amp; $.inArray(that._formatStr(value),that.options.availableTags)==-1) { isNew = false; return false; } }); return isNew; } </code></pre> <p>Now you can use the options when you initialize tagit. only the sampleTags are allowed with a maximum of 3 tags</p> <pre><code>$(function(){ var sampleTags = ['php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python']; //------------------------------- // Tag events //------------------------------- var eventTags = $('#s_tags'); eventTags.tagit({ availableTags: sampleTags, caseSensitive: false, onlyAvailableTags: true, maxTags:3, }) }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload