Is there is a way for me to access the updater function from outside of the typeahead scope ?
My current example is that in the updater function, I have some custom logic that creates some html and appends it to the body such as with the following snippet example:
updater: function(item){
$input = $('<span/>',{
class:'label label-info',
text:item,
style:'margin-left:4px'
});
...
$('#tagContainer').append($input);
}
Now my question is: Is it possible for me to link this function to a button so that it is triggered when the button is clicked, considering that I will pass it the ‘item’ parameter ?
I guess this problem involves something about functions scope, and this is where my knowledge lack, and need some insight.
Define it as a separate function: