I am using Bootstrap Tags Input
I am trying to add tags dynamically.
$('.div-tag').tagsinput('add', 'vino');
The above code works fine, but when I try the following code:
$('.div-tag').tagsinput('add', { id: 1, text: 'some tag' });
I get the error:
Uncaught Can't add objects when itemValue option is not set
Please help me to add tag with id and value.
This library is broken, don't bother. The accepted answer doesn't work on version 0.8. After 1h of trying several things, I suggest to switch to another library, I used tagEditor , where everything worked on the 1st try.
I spent few hours to find out, that above working only when data-role="tagsinput" is removed from your
Please try like this:
initialize tags input like
To add dynamic tag
That's it;
There is nothing wrong with the library, but when you get this error it means there is a problem with the method initilization.
Try to do it when the page is ready like so: