Search code examples
jquerytwitter-bootstrap-3bootstrap-tags-input

Bootstrap tags input with CloudSponge - how to add tag


I'm trying to integrate Bootstrap 3 TagsInput plugin with CloudSponge. Specifically I want to use CloudSponge to allow a user to select multiple contacts from an address book and have the results populate an input field that uses the TagsInput plugin.

The stumbling block at this point is simply adding a tag to the input field without needing to type it in. The standard jquery tagsinput plugin has an addTag method, and the bootstrap-tagsinput plugin has an add method.

If I'm using this to initialize my input field:

var obj = $('#inputEmail').tagsinput()

How might I call the add method and pass in a string?


Solution

  • Call

    $('input').tagsinput('add', 'your string');
    

    See Documentation