JQuery tagit navigation keyboard not working

As mentioned in the question, we are using jQuery Tagit for our project. We use ajax search to populate keywords. The problem we are facing here is that when you click on the search results with the mouse, it works exactly as described, however, if we use the keyboard navigation to select the result, then the next time the ajax search doesn’t will be performed for pressing the first keyword (it only works after pressing the second keyword). To add, the whole process works very well if we do the same with the mouse. I hope I get it. Please find the following code:

$('#tags_3').tagit({
    allowSpaces: false,
    placeholderText: 'Search Clients',
    autocomplete: ({
        source: function(request, response) {
            // alert(request.term);
            $.ajax({
                url: '/searchClients',
                data: {
                    format: "json",
                    keywords: request.term
                },
                dataType: 'json',
                type: 'GET',
                success: function(data) {
                    response($.map(data, function(item) {
                        return {
                            label: item.name,
                            value: item.name
                        }
                    }));
                },
                error: function(request, status, error) {
                    alert(error);
                },
                complete: function(request, status, error) {}
            })
        },
    })
});

Edit 1: Problem found on documentation page as well

, . , "a", , "a" , . , ...!

.

+4

Source: https://habr.com/ru/post/1569019/


All Articles