最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Auto complete Appearing behind the Modal popup - Stack Overflow

programmeradmin2浏览0评论

I am using simple jquery popup and Auto complete of jQuery Auto complete .The code of Auto complete is something like this.

$("#tags").autocomplete({
    source: NameArray
});

where tags is the textbox id and NameArray is Array of string.However this code in the Modal pop-up like this-

function openFilterPopUp() {

    $("#tags").autocomplete({
        source: NameArray
    });
    $("#openFilterPopUp").dialog({
        resizable: false,
        height: 240,
        modal: true,
        buttons: {
            "ok": function() { $(this).dialog("close"); },
            Cancel: function() { $(this).dialog("close"); }
        }
    });

}

The data for Autocomplete is appearing fine but its appearing behind the popup.Please Help. Any help will be appreciated.

I am using simple jquery popup and Auto complete of jQuery Auto complete .The code of Auto complete is something like this.

$("#tags").autocomplete({
    source: NameArray
});

where tags is the textbox id and NameArray is Array of string.However this code in the Modal pop-up like this-

function openFilterPopUp() {

    $("#tags").autocomplete({
        source: NameArray
    });
    $("#openFilterPopUp").dialog({
        resizable: false,
        height: 240,
        modal: true,
        buttons: {
            "ok": function() { $(this).dialog("close"); },
            Cancel: function() { $(this).dialog("close"); }
        }
    });

}

The data for Autocomplete is appearing fine but its appearing behind the popup.Please Help. Any help will be appreciated.

Share Improve this question edited Sep 14, 2017 at 14:45 Axel 3,32311 gold badges37 silver badges59 bronze badges asked Mar 12, 2014 at 6:20 coolhimanshucoolhimanshu 6473 gold badges13 silver badges26 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 18

Add appendTo property of autocomplete

$("#tags").autocomplete({
    source: NameArray,
    appendTo : _parentElement
});

_parentElement can be your modal body

I try this code and success :

$("#tagsname").autocomplete({
    appendTo : "#modalform",
    source: DataArray
    
});

发布评论

评论列表(0)

  1. 暂无评论