Sha256: e2243ee8043a709f74474f4e38d534905c7ea03fec802263c98a7e0e1a7e6a9b
Contents?: true
Size: 1.17 KB
Versions: 21
Compression:
Stored size: 1.17 KB
Contents
function onAddTag(tag) { alert("Added a tag: " + tag); } function onRemoveTag(tag) { alert("Removed a tag: " + tag); } function onChangeTag(input,tag) { alert("Changed a tag: " + tag); } $(function() { $('#tags_1').tagsInput({width:'auto'}); $('#tags_2').tagsInput({ width: 'auto', onChange: function(elem, elem_tags) { var languages = ['php','ruby','javascript']; $('.tag', elem_tags).each(function() { if($(this).text().search(new RegExp('\\b(' + languages.join('|') + ')\\b')) >= 0) $(this).css('background-color', 'yellow'); }); } }); $('#tags_3').tagsInput({ width: 'auto', //autocomplete_url:'test/fake_plaintext_endpoint.html' //jquery.autocomplete (not jquery ui) autocomplete_url:'test/fake_json_endpoint.html' // jquery ui autocomplete requires a json endpoint }); // Uncomment this line to see the callback functions in action // $('input.tags').tagsInput({onAddTag:onAddTag,onRemoveTag:onRemoveTag,onChange: onChangeTag}); // Uncomment this line to see an input with no interface for adding new tags. // $('input.tags').tagsInput({interactive:false}); });
Version data entries
21 entries across 21 versions & 1 rubygems