Bootstrap Tags Input how to bind function to event itemAdded and itemRemoved?
Asked Answered
F

1

5

There is no documentation about events on the website, any ideas ?http://timschlechter.github.io/bootstrap-tagsinput/examples/

Frowsy answered 24/1, 2014 at 15:33 Comment(1)
For anyone interested, this is fully documented now: bootstrap-tagsinput.github.io/bootstrap-tagsinput/examplesBurnett
P
17

Maybe the author have not had the time to document it yet? :-) But, bootstrap-tags triggers two signifcant events : itemAdded and itemRemoved.

Here is an example you can try out :

markup :

<input type="text" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput" placeholder="Add tags" id="tag"/>

event listeners :

$("#tag").on('itemAdded', function(event) {
    console.log('item added : '+event.item);
});
$("#tag").on('itemRemoved', function(event) {
    console.log('item removed : '+event.item);
});

Here you go on your question.

Phillis answered 24/1, 2014 at 15:49 Comment(3)
@unclesol, investigate the code, it is not so complicated, my answer should not be there in the first place ...Phillis
Works for me :)Bruise
Great!. Works WELLPsychologist

© 2022 - 2024 — McMap. All rights reserved.