I'm using the MapboxGeocoder with the countries
option set to a default country, but I would like to update this option if the user changes the country they want to search in.
Current code:
// Add the control to the map.
const geocoder = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl,
marker: false,
countries: 'nz'
});
I'm using the chosen plugin from harvest, so I have the on change
function working, I need to know if it's possible to change the countries
option when they change the country so that results searched for will only return for the current country they have selected
// Country selection changed
$('#country_id').on('change', function(evt, params) {
// Check it's not empty
if (params) {
// code to go in here to change 'countries' option
}
});