You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added 1 line of code in your plugin today and i wanted to "commit" my change here:
File:
jquery.crs.js (0.4.0)
Line 212:
(Added) populateRegionFields: _populateRegionFields
So I can call this specific row of code to update the Region Select after I'm setting the value via jQuery:
EXAMPLE
window.crs.init();
$.getJSON('//freegeoip.net/json/', function(result) {
$('#crs-country').val(result.country_code);
window.crs.populateRegionFields($('#crs-country')[0],$('#crs-region')[0]);
});
This Method will locate the current CountryCode from freegeoip.net and determine from which Country the Visitor is coming from and it will assign the value automatically to the Country Select and "repopulate" the Region Select with the current Country Select Value.
I hope I could help a little for others that run in to the same "issue" of a missing region reload method C:
Kind Regards
Mike of Creative-House.org
The text was updated successfully, but these errors were encountered:
You need to put a comma at the end of Line 211, i.e.
return {
init: _init,
populateRegionFields: _populateRegionFields
};
While this does populate the regions field with the correct drop down list, it does not make the data-default-value the selected option. For that, you'll need to add a line like
$("#crs-region").val($("#crs-region").attr("data-default-value"));
Incidentally, there should be a way to write a method that does the same thing, but doesn't require any arguments. I'm not enough of a javascript wiz to figure it out. Thankfully, your simple change does the trick, albeit less elegantly.
Hello
I added 1 line of code in your plugin today and i wanted to "commit" my change here:
File:
jquery.crs.js (0.4.0)
Line 212:
(Added) populateRegionFields: _populateRegionFields
So I can call this specific row of code to update the Region Select after I'm setting the value via jQuery:
EXAMPLE$('#crs-country')[0],$ ('#crs-region')[0]);
window.crs.init();
$.getJSON('//freegeoip.net/json/', function(result) {
$('#crs-country').val(result.country_code);
window.crs.populateRegionFields(
});
This Method will locate the current CountryCode from freegeoip.net and determine from which Country the Visitor is coming from and it will assign the value automatically to the Country Select and "repopulate" the Region Select with the current Country Select Value.
I hope I could help a little for others that run in to the same "issue" of a missing region reload method C:
Kind Regards
Mike of Creative-House.org
The text was updated successfully, but these errors were encountered: