tag-it

How we can get the ID of selected tags using Jquery tagit?

谁说我不能喝 提交于 2019-11-28 04:42:55
问题 I have a input tag field ,and I want to get the ID of the selected tages So I have try http://jsfiddle.net/u8zj5/19/ But my problem I want to get the id not label or value to pass into id="show" but I failed. <input type="text" id="field1" name="field1" value=""/> <span id="show">show ID here</span> jQuery(document).ready(function(){ var availableTags = [{"id":"144","label":"Allicelabel","value":"Allice value"}]; jQuery("input#field1").each(function(){ var target = jQuery(this); var

Trying to get tag-it to work with an AJAX call

妖精的绣舞 提交于 2019-11-27 10:28:22
Trying to get tag-it to work with an ajax call. Everything works so far. Except, I am unable to assign a tagSource via an ajax call. In firebug, the 'data' is returning: ["Ruby","Ruby On Rails"] But its not showing up as I type into the input box. $('.tags ul').tagit({ itemName: 'question', fieldName: 'tags', removeConfirmation: true, availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"], allowSpaces: true, // tagSource: ['foo', 'bar'] tagSource: function() { $.ajax({ url: "/autocomplete_tags.json", dataType: "json", data: { term: 'ruby' }, success: function(data) {