Search on Click with Jquery's Autocomplete

后端 未结 5 1889
自闭症患者
自闭症患者 2021-02-14 04:20

I am trying to simulate the Youtube Autocomplete Search experience.

I can\'t find the option when the viewer clicks on a listed item and is automatically proceeded to se

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-14 04:55

    $(function() {
    $( "#search" ).autocomplete(
        {
             source:'/search-terms.php',
             focus: function(event, ui) {
                 $("input#search").val(ui.item.label);
             },
             select: function(event, ui) {
    
                $("#searchform button").click(); }
        })
    });
    

    I am using this working fine :)

提交回复
热议问题