After looking into the documentation there are couple of events like when a new element is added, when its removed, when its cleared, when its reorderd etc. I will give you the sample of adding and removing the element to trigger a event.
$('#tokenize').tokenize({
onAddToken: function(value, text, e){
alert('added new item :' + text);
},
onRemoveToken: function(value, text, e){
alert('removed item :' + text);
},
});
EDIT 1: Since you want to add events only for selected page and not all and this piece of code is reused in many places of your application , you can do this.
Define the functions that need to trigger when adding new items, make sure you define the function only in the selected pages and then on the api call check if the function exist.. if exist then execute else not, Below is the sample.
Define a function
function AddNewItemHandler(value, text, e)
{
alert('added new item :' + text);
}
then the changes in plugin must be something like below.
$('#tokenize').tokenize({
onAddToken: function(value, text, e){
if ($.isFunction(AddNewItemHandler)) { // check if func exists
AddNewItemHandler(value, text, e); // if true execute it
}
}
});
So other pages will not have function defined and hence will not execute it..