javascript标记它允许的标记
我需要允许用户在tagSource中只选择允许的标记 目前我有:javascript标记它允许的标记,javascript,jquery,tag-it,Javascript,Jquery,Tag It,我需要允许用户在tagSource中只选择允许的标记 目前我有: var sampleTags = ['c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python', 'c', 'scala', 'groovy', 'haskell', 'perl', 'erlang', 'apl', 'cobol', 'go', 'lua']; $("#myTags").tagit({ tagSource: sampl
var sampleTags = ['c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python', 'c', 'scala', 'groovy', 'haskell', 'perl', 'erlang', 'apl', 'cobol', 'go', 'lua'];
$("#myTags").tagit({
tagSource: sampleTags
});
你能帮我一下吗?检查一下这个,它会工作的
var sampleTags = ['c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python', 'c', 'scala', 'groovy', 'haskell', 'perl', 'erlang', 'apl', 'cobol', 'go', 'lua'];
$("#myTags").tagit({
availableTags: sampleTags,
afterTagAdded: function (event, ui) {
if ($.inArray(ui.tagLabel, sampleTags) == -1) {
$("#myTags").tagit("removeTagByLabel", ui.tagLabel);
}
}
});
tagit({availableTags:[“c++”,“java”,“php”,“javascript”,“ruby”,“python”,“c”]})代码>但用户仍然可以创建新标记。