Example



How To

HTML:


<!-- Find Me button -->
<button> id="findMe"></button>t;
<!-- Search input -->
<input type='text' id='searcPlace'>
!-- Address input -->
<input type='text' id='addr'>
!--  Latitude input-->
<input type='text' id='lat'>
!-- Longitude input -->
<input type='text' id='lng'>
                

JS:

                        
                            new Mapitool("map",
                            {
                                type: 'AutoComplete',
                                language: 'en',
                                apiKey: 'YOUR_API_KEY',
                                autoComplete: true,
                                searchInput: 'searcPlace',
                                findMe: true,
                                findMeButton: 'findMe',
                                result: function (address, lat, lng, error) {
                                    if (error) {
                                        switch (error.code) {
                                            case error.PERMISSION_DENIED:
                                                window.alert("PERMISSION_DENIED");
                                                break;
                                            case error.POSITION_UNAVAILABLE:
                                                window.alert("POSITION_UNAVAILABLE");
                                                break;
                                            case error.TIMEOUT:
                                                window.alert("TIMEOUT");
                                                break;
                                            case error.UNKNOWN_ERROR:
                                                window.alert("UNKNOWN_ERROR");
                                                break;
                                        }
                                    }else {
                                        document.getElementById('addr').value = address;
                                        document.getElementById('lat').value = lat;
                                        document.getElementById('lng').value = lng;
                                    }
                                }
                            });