Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zenoo/address-search
Address searching with typeaheads and multiple choices
https://github.com/zenoo/address-search
address-search autocomplete
Last synced: 27 days ago
JSON representation
Address searching with typeaheads and multiple choices
- Host: GitHub
- URL: https://github.com/zenoo/address-search
- Owner: Zenoo
- License: mit
- Created: 2018-08-01T08:10:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T05:48:48.000Z (almost 2 years ago)
- Last Synced: 2024-11-14T16:55:43.039Z (about 1 month ago)
- Topics: address-search, autocomplete
- Language: JavaScript
- Homepage:
- Size: 1.18 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# AddressSearch [(Demo)](https://jsfiddle.net/Zenoo0/tqo1mxsc/)
![Dependencies](https://david-dm.org/Zenoo/address-search.svg)
Address searching with typeaheads and multiple choices
### Doc
* **Installation**
Simply import Google Places API & AddressSearch into your HTML.
``````
* **How to use**Create a new [`AddressSearch`](https://zenoo.github.io/address-search/AddressSearch.html) object with a query String or an Element as the first parameter :
```
let address = new AddressSearch('div.with[any="selector"]', options, delay);
// OR
let element = document.querySelector('li.terally[any="thing"]');
let address = new AddressSearch(element, options, delay);
```
* **Options**You can automatically fill inputs with address informations when the user selects an address.
To do that, simply add the information type you want and the selector for the input to fill.The `options` object works as follows
```
// GET THE COMPONENT FULL NAME
typename : 'targetInput[selector]'
// GET THE COMPONENT SHORT NAME
typename_short : 'targetInput[selector]'
```Available components:
```
{
street_number: '...',
route: '...',
country: '...',
administrative_area_level_1: '...',
administrative_area_level_2: '...',
administrative_area_level_3: '...',
administrative_area_level_4: '...',
administrative_area_level_5: '...',
colloquial_area: '...',
locality: '...',
sublocality: '...',
neighborhood: '...',
premise: '...',
subpremise: '...',
postal_code: '...',
point_of_interest: '...'
}
```
* **Delay**You can use the third parameter to enter a delay (ms).
This delay will be used before displaying Google API predictions after each keypress.
This can help you mitigate the amount of requests made on your account.The `delay` parameter works as follows
```
new AddressSearch(element, options, 500);
```
* **Methods**See the [documentation](https://zenoo.github.io/address-search/AddressSearch.html) for the method definitions.
* **Example**
See this [JSFiddle](https://jsfiddle.net/Zenoo0/tqo1mxsc/) for a working example
## Authors
* **Zenoo** - *Initial work* - [Zenoo.fr](https://zenoo.fr)