I am now trying to add a Google Map Places Search Box on to my webpage. I'd like to add it on to a Bootstrap modals. I have successfully add the Box; however, the search result is hidden under the modal, as the picture shown below. I don't know how to fix this. Could anyone please give me some suggestion? Thanks.
Here is how I add the search box using javaScript:
function searchBoxInit(){
var input = /** @type {HTMLInputElement} */(document.getElementById('pac-input'));
//map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
var searchBox = new google.maps.places.SearchBox(/** @type {HTMLInputElement} */(input));
google.maps.event.addListener(searchBox, 'places_changed', function() {
var places = searchBox.getPlaces();
if (places.length == 0) {
return;
}
place = places[0];
newpName = place.name;
newpLat = place.geometry.location.lat();
newpLong = place.geometry.location.lng();
});
}
function displaySearchEngine(){
var objElement = document.getElementById('pac-input');
searchBoxInit();
objElement.style.display = 'block';
objElement.style.visibility = 'visible';
}
Bootstrap http://getbootstrap.com/javascript/#modals
Places search box https://developers.google.com/maps/documentation/javascript/examples/places-searchbox?hl=zh-Tw