Closed hieuhlc closed 8 years ago
Hi you can use the events below:
Do you have any example code how to implement those events? I tried to bind a keydown event but it wasn't working. Thanks.
$('.tokenize-demo').keydown(function(event) {
if (event.keyCode == 13) {
alert('enter pressed');
console.log('enter pressed');
}
});
@eliluong this is sample code from Tokenize 2 config docs
$('.tokenize-source-demo-3').tokenize2({
dataSource: function(search){
var $this = $('.tokenize-source-demo-3').data('tokenize2');
$.ajax('remote.php', {
data: { search: search, start: 0 },
dataType: 'json',
success: function(data){
var $items = [];
$.each(data, function(k, v){
$items.push(v);
});
$this.trigger('tokenize:dropdown:fill', [$items]);
}
});
}
});
Btw @zellerda i fixed the problem. It's not Tokenize2 bug, it's mine.
I can see that tokenize inited without error. But I don't know why suggestion not showing when I type. I noticed there was some changes in DOM.
Is there any binding event when user's typing? If so I can debug from there, now I have no clue. Thank you.