jQueryUI autocomplete not working with dialog and zIndex

前端 未结 14 1099
孤独总比滥情好
孤独总比滥情好 2021-02-05 00:51

I ran into an interesting issue with jQueryUI autocomplete in a dialog box.

My dialog HTML looks like this:

14条回答
  •  走了就别回头了
    2021-02-05 01:00

    Through pursuing this problem myself I discovered that appendTo has to be set before the dialog is opened. The same seems to apply to setting (or modifying) the source property.

    $("#mycontrol").autocomplete({appendTo:"#myDialog",source:[..some values]})
    $("#mycontrol").autocomplete("option","source",[...some different values]) // works
    
    // doesn't work if the lines above come after
    $("#myDialog").dialog("open")
    

    This might just be a byproduct of what dialog open does, or not correctly addressing the element. But the order things happen seems to matter.

提交回复
热议问题