max-favilli / tagmanager

A jQuery plugin (working nicely with twitter bootstrap)
Mozilla Public License 2.0
770 stars 236 forks source link

tagsContainer option doesn't work with .tagsManager('pushTag', 'I_am_a_new_tag') method #76

Closed fabian-dz closed 11 years ago

fabian-dz commented 11 years ago

I turned an input field into a tags manager with "tagsContainer" using this command: $(".tagManager").tagsManager({tagsContainer: "#my-tags-container"});

Once tagsManager has been created, I want to push some new tags via pushTag method: "$(".tagManager").tagsManager('pushTag','I_am_a_new_tag');". The problem here is new tags aren't added into "#my-tags-container" element, defined above. They are added into DOM using default behavior, it means with not container.

johnnyshields commented 11 years ago

I just tested this on latest master and confirmed it works correctly, so I'm closing the issue. Can you re-test, and if you still have the problem please reopen with HTML/Javascript to reproduce the issue?

nurp commented 11 years ago

I also had this problem. tagManagerOptions are reset when I call "$(".tagManager").tagsManager('pushTag', '..')" again. I am trying to add the tags when a user clicks on a button. html:

javascript: $('#editPhlink').tagsManager({ prefilled : pet.Links, blinkBGColor_1 : '#FFFF9C', blinkBGColor_2 : '#CDE69C', hiddenTagListName : 'edithiddenTLPhLinks', tagsContainer: '#editPhotoLinksPreview', delimeters : [9, 13], }); $('#addPhLink').on('click', addPhLinkFunc.bind(null, $('#editPhlink')));

function addPhLinkFunc(obj){ obj.tagsManager('pushTag', obj.val()); }

johnnyshields commented 11 years ago

@nurp have reopened. Can you make a JS Fiddle for this?

nurp commented 11 years ago

Jsfiddle: http://jsfiddle.net/luya/EC3Qx/ But it works there. So I don't know. It must be something else then.. Thanks

johnnyshields commented 11 years ago

ok closing until we can get a reproducible example to troubleshoot.