Either I am an idiot or this was an egregious oversight on the part of the Google Maps team.
I am attempting to trigger a places search request on a button click event i
It is more simple than you think. With same starting point as above, https://developers.google.com/maps/documentation/javascript/examples/places-searchbox
Add a button to the HTML
in initialize()
add this to the very end, before }
:
var button = document.getElementById('button');
button.onclick = function() {
input.value='test';
input.focus();
}
input
is already defined. All you have to do, to trigger the places search by a button is - really - to focus
the input box associated with the searchBox. You dont have to mingle with searchBox or trigger "places_changed" or anything like that, which you can see elsewhere as suggestions - but in fact is not working.
I guess you want to trigger by a button "for some reason", like searching for some specific predifined - thats why I trigger the search with "test", simply by setting the input value to test.
Updated with working demo, based on the google example above -> http://jsfiddle.net/7JTup/