Autocomplete Address Search Bar
Submitted by alpha_luna on Thursday, July 14, 2016 - 13:45.
Autocomplete Address Search Bar
In this tutorial, we are going to create Autocomplete Address Search Bar. We are going to use JavaScript Library to create this simple program in autocomplete address search bar. You can use this program in your website or systems for the user to search their desired location or address that they want. A user enters the address or location that they want, then it will display those places in dropdown element and they can select the address that they want to.Creating Markup
This short source code consists one TextBox where the user can type their desired address or location that they want to search and the container for the result.JavaScript Code
This script will help us to display those places when the user enters their desired address to search in TextBox.- <script src="places.min.js"></script>
- <script>
- (function() {
- var placesAutocomplete = places({
- container: document.querySelector('#address')
- });
- var $address = document.querySelector('#address-value')
- placesAutocomplete.on('change', function(e) {
- $address.textContent = e.suggestion.value
- });
- placesAutocomplete.on('clear', function() {
- $address.textContent = 'none';
- });
- })();
- </script>
Output
The user enters their desired address or location to search. Look like.


Add new comment
- 156 views