Google Maps Autocomplete Result in Bootstrap Modal Dialog

前端 未结 9 958
孤城傲影
孤城傲影 2020-12-07 17:22

I have a Google Maps Autocomplete input field inside a Twitter Bootstrap modal dialog and the autocomplete result is not displayed. However, if I press the down arrow key, i

9条回答
  •  孤街浪徒
    2020-12-07 18:02

    I have spend 2,3 hours to just digging out the error with google places API drop down z index. Finally I have found this. Just paste this code at top of your JS script and update the input id name.

    var pacContainerInitialized = false;
    $("#inputField").keypress(function() {
      if (!pacContainerInitialized) {
        $(".pac-container").css("z-index", "9999");
        pacContainerInitialized = true;
      }
    });
    

    Full reference link. https://groups.google.com/forum/#!topic/google-maps-js-api-v3/GZX0ynQNn1M Thanks to Gautam.

提交回复
热议问题