Closed matthew-davis closed 8 years ago
Having the same question
@matthew-davis and @lem93 hi! You can set location with help of simulation events. Just write something like this
<button id="doIT">Do IT</button>
<script>
$('#us3').locationpicker({
inputBinding: {
latitudeInput: $('#us3-lat'),
longitudeInput: $('#us3-lon'),
}
});
$('#doIT').on('click', function (e) {
e.type = 'change';
$('#us3-lat').val(-5.087353864895619).trigger(e);
$('#us3-lon').val(112.17068155859374).trigger(e);
})
</script>
I hope it help you.
Love the plugin, I'm having an issue attempting to programmatically set the map location.
This questions has been asked a few times without an answer: http://stackoverflow.com/questions/31631777/logicify-location-picker-using-dynamic-change-for-input https://github.com/Logicify/jquery-locationpicker-plugin/issues/20
Essentially I would assume that I could programmatically set the values of latitude and/or longitude and the plugin would respond as if I had typed those values in (through the inputBinding latitude and longitude 'on('change' functions). However it doesn't.
I've tried various attempts at calling .locationpicker() after resetting the values or .trigger() on the values themselves. I'm not sure how to proceed if I can't get the inputBindings to fire.
Can anyone steer me in a direction to get the inputBinding functions to pick up on programmatically setting the lat and long?