Same problem as Changing Token Limit Dynamically on add function of jquery token input
I need to change the token limit of a token input textbox dynamically based on its add and on delete functions. In my case when the user selects an item called "text" from the list, the token limit should change to 1 otherwise null.
$("[id$=searchbox]").tokenInput(itemsArray,
{
onAdd: function(item)
{
//What to write here to set token limit
}
});
If you read the sources you find out that the
tokenLimit
setting is always read from$(input).data("settings").tokenLimit
.This means you can also set it from outside at any time.
Now add your custom logic.