JQuery UI autocomplete for content in bootstrap modal

跟風遠走 提交于 2019-12-11 11:32:20

问题


I have AJAX generated content in bootstrap modal which have elements that using tags-input plugin and also jquery autocomplete for suggestion.

These tools work properly when the element exist off the modal. So problem occur when I use bootstrap modal with jquery autocomplete. Means the autocomplete list won't be shown up anymore. But result will come back from server

The tag input element:

<input type="text" class="form-control" name="keyword[]" data-toggle="tag_autocomplete" />

JS which call initiator:

tag_autocomplete('[data-toggle="tag_autocomplete"]');

And eventually my initiator:

function tag_autocomplete(selector)
{
    $(selector).tagsInput({
        autocomplete_url: base_url + 'tag/autocomplete',
        width:'auto',
        defaultText:'+',
        minChars: 2,
        maxChars : 50,
        placeholderColor : '#666666'
    });
}

Result given from jquery autocomplete:

[{tag_id: "3", label: "hossein", value: "hossein"}]
    0: {tag_id: "3", label: "hossein", value: "hossein"}

Thanks in advance


回答1:


That is z-index issue, to give auto complete result listing higher priority just add bellow css class and add property:

.ui-autocomplete
{
    z-index: 99999; //Maximum and top of everything (not absolutely :| )
}


来源:https://stackoverflow.com/questions/31890816/jquery-ui-autocomplete-for-content-in-bootstrap-modal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!