【问题标题】:Google location autocomplete not working inside modal谷歌位置自动完成在模态中不起作用
【发布时间】:2016-12-13 11:47:22
【问题描述】:

我在模态框内使用谷歌自动完成功能。当我单击输入字段时,它会显示模式后面的结果。我没有使用任何CSS。它在模态之外完美工作。但它在模态中无法正常工作。请帮帮我。

HTML 代码

<div class="form-group">
    <p class="control-label1">City</p>
    <input type="text" id="locationTextField" placeholder="" name="city" class="form-control">
</div>

Javascript 代码

//Google Map
function initialize() {
    var input = document.getElementById('locationTextField');
    var autocomplete = new google.maps.places.Autocomplete(input);
}

function validateCity() {
    searchfield = $('#locationTextField').val();
    if (searchfield == "" || searchfield == null) {
        return false;
    }
    else {
        $('#locationTextField').val('');
        return false;
    }
}
google.maps.event.addDomListener(window, 'load', initialize);

【问题讨论】:

  • 能否提供您的html 代码
  • @RonyLoud 我找到了答案。

标签: javascript jquery twitter-bootstrap modal-dialog bootstrap-modal


【解决方案1】:

我通过在 css 中添加以下代码找到了答案

div.pac-container {
   z-index: 1050 !important;
}

【讨论】:

  • 很容易修复,很好的答案
  • 欢迎@DeepakDholiyan :)
猜你喜欢
  • 2012-08-02
  • 1970-01-01
  • 2016-11-11
  • 2016-12-17
  • 1970-01-01
  • 2012-02-20
  • 1970-01-01
  • 2013-09-25
  • 1970-01-01
相关资源
最近更新 更多