Add additional link to jquery ui autocomplete list

前端 未结 1 1904
广开言路
广开言路 2021-01-22 03:37

Sorry I couldn\'t find a clear solution on how to do this. I\'m using jQuery UI autocomplete on a textbox that retrieves data from a database. I need to add an \"Ad

相关标签:
1条回答
  • 2021-01-22 04:26

    I suppose you could add the li in one of Autocomplete's callbacks, like open:

    $('#venue').autocomplete({
        open: function () {
            // If it's not already added
            if (!$('#ac-add-venue').length) {
                // Add it
                $('<li id="ac-add-venue"><a href="....">Add venue</a></li>').appendTo('ul.ui-autocomplete');
            }
        }
    });
    

    You may need to change some selectors.

    Edit: Btw: there's no way that can be all your code? It's missing several closing }:s for one.

    0 讨论(0)
提交回复
热议问题