keep ui autocomplete open at all times

前端 未结 4 1203
渐次进展
渐次进展 2020-12-06 05:51

I\'m using the ui autocomplete: over here

I need the autocomplete to be open at all times, so it shouldn\'t close when somewhere in the body is clicked. I have googl

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 06:21

    Hey sorry for the late response!

    I feel this is a lot cleaner than keeping focus on the input and searching multiple times.

    Try this...

    JAVASCRIPT:

    $( "#input1" ).autocomplete({
        source: availableTags,
        close : function (event, ui) {
            if (!$("ul.ui-autocomplete").is(":visible")) {
                $("ul.ui-autocomplete").show();
            }
        }
    });
    

    DEMO: http://jsfiddle.net/dirtyd77/AJtvJ/

    Hope this helps!

提交回复
热议问题