jquery-locationpicker-plugin
jquery-locationpicker-plugin copied to clipboard
Clear on :focus
First of all, thank you for creating such an awesome script.
I'd like to know if
- it is possible to clear the 'address' field on page load and
- assuming there are other input fields to fill, not submitting the form when we accidentally press 'Enter/Return'
What would be the best practice if I'd like to accomplish the above.
Thanks & have a good day.
;)
Hi @yanseo! Thank you :)
First: It seems like issue #11; Code example:
$('#map').locationpicker({
inputBinding: {
locationNameInput: $('#input-address')
},
oninitialized : function (component) {
$('#input-address').val('');
}
});
Second: If i have fully understood your issue, that you need initialize another input field and grab just their value, but question consist of 'how i can programmatically autocomplete location' or 'what is correct behavior of program on accidentally press Enter' ?
Thanks, Sumragen for your reply.
This doesn't work though, the map disappeared and no autosuggestion ;(
$('#map').locationpicker({ inputBinding: { locationNameInput: $('#input-address') }, oninitialized : function (component) { $('#input-address').val(''); } enableAutocomplete: true, onchanged: function (currentLocation, radius, isMarkerDropped) { } });
Am I missing something here?
PS: This is the working code for me but I need to clear the field first before I could add another address which is of course not so user-friendly
$('#map').locationpicker({ location: { latitude: 3.139003, longitude: 101.68685499999992 }, radius: 300, inputBinding: { latitudeInput: $('#map-latt'), longitudeInput: $('#map-long'), radiusInput: $('#map-radius'), locationNameInput: $('#input-address') }, enableAutocomplete: true, onchanged: function (currentLocation, radius, isMarkerDropped) { } });
Anybody have a solution for this?