Skip to content

Commit

Permalink
Added option to customize placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-cz committed Jan 27, 2020
1 parent 8f99306 commit a5218cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ Option | Default | Version | Description
`callback` | - | v0.0.5 | any valid function as callback. By default internal callback is set and just pan the map to found position
`autocomplete_options`| {} | v0.0.5 | default options for google autocomplete
`collapsed_mode` | `false`:bool | v0.0.6 | if set to true, then just click-able icon will be displayed
`placeholder` | `null`:string | v0.0.7 | custom placeholder for input text
5 changes: 5 additions & 0 deletions src/js/leaflet-gplaces-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
position: "topright",
prepend: true,
collapsed_mode: false,
placeholder: null,
autocomplete_options: {}
},

Expand Down Expand Up @@ -33,6 +34,10 @@
this.searchBox = L.DomUtil.create("input", "leaflet-gac-control");
this.autocomplete = new google.maps.places.Autocomplete(this.searchBox, this.options.autocomplete_options);

if (this.options.placeholder) {
this.searchBox.setAttribute("placeholder", this.options.placeholder)
}

// if collapse mode set - create icon and register events
if (this.options.collapsed_mode) {
this.collapsedModeIsExpanded = false;
Expand Down

0 comments on commit a5218cf

Please sign in to comment.