$(document).ready(function(){ $("#testtag1").tagsInit(); });
$(document).ready(function(){ $("#testtag2").tagsInit({ inputNote:"Type Something Here", del:false, beforeInput:function(tagValue){ if(tagValue=='aaa'){ alert("aaa is not allowed"); return false; } } }); });
$(document).ready(function(){ $("#testtag3").tagsInit({ repeat:'Duplicate Tag', action:{href:'https://www.google.com/search?q=%v%',target:'_blank'} }); $("#testtag4").tagsInit({ onDel:function(){alert("Can NOT be deleted");return false;}, action:function(tagValue){alert(tagValue);}, theme:'black' }); });
<div> <input type="button" onclick="mytagsAdd()" value="tagsAdd"/> <input type="button" onclick="mytagsDel()" value="tagsDel"/> <input type="button" onclick="mytagsClear()" value="tagsClear"/> <input type="button" onclick="mytagsCount()" value="tagsCount"/> <input type="button" onclick="mytagsIndexof()" value="tagsIndexof"/> <input type="button" onclick="mytagsStr()" value="tagsStr"/> <input type="button" onclick="mytagsJson()" value="tagsJson"/> </div> <div id="testtag6" tagname="test6"></div>
var tag6=$("#testtag6").tagsInit(); function mytagsAdd(){ tag6.tagsAdd(prompt("Tag Value")); } function mytagsDel(){ tag6.tagsDel(prompt("Tag Value")); } function mytagsClear(){ tag6.tagsClear(); } function mytagsCount(){ alert(tag6.tagsCount()); } function mytagsIndexof(){ alert(tag6.tagsIndexof(prompt("Tag Value"))); } function mytagsStr(){ alert(tag6.tagsStr()); } function mytagsJson(){ alert(tag6.tagsJson()); }