Skip to content

Commit

Permalink
Merge pull request #10 from piotr-cz/feature/placeholder
Browse files Browse the repository at this point in the history
Added option to customize placeholder
  • Loading branch information
Twista authored Jun 3, 2020
2 parents 8f99306 + a5218cf commit 8a4662a
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

1 comment on commit 8a4662a

@AkshayGore
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to enable icon or marker on search location?
Please help

Please sign in to comment.