google.maps.places.SearchBox
class
A widget that provides query predictions based on a user's text input. It attaches to an input element of type text, and listens for text entry in that field. The list of predictions is presented as a drop-down list, and is updated as text is entered.
This class extends
MVCObject.
places
| Constructor | |
|---|---|
SearchBox |
SearchBox(inputField[, opts])Parameters:
Creates a new instance of SearchBox that attaches to the specified input text field with the given options. |
| Methods | |
|---|---|
getBounds |
getBounds()Parameters: None
Return Value:
LatLngBoundsReturns the bounds to which query predictions are biased. |
getPlaces |
getPlaces()Parameters: None
Return Value:
Array<PlaceResult>Returns the query selected by the user, or null if no places have been found yet, to be used with places_changed event. |
setBounds |
setBounds(bounds)Parameters:
Return Value: None
Sets the region to use for biasing query predictions. Results will only be biased towards this area and not be completely restricted to it. |
| Events | |
|---|---|
places_changed |
function()Arguments: None
This event is fired when the user selects a query, getPlaces should be used to get new places. |