Dynamically Change Google Maps Script Src With Select
Solution 1:
You shouldn't do it like that, because removing a script-element doesn't remove the methods,variables etc. that have been created by the script. You will receive a warning like that:
Warning: you have included the Google Maps API multiple times on this page. This may cause unexpected errors
Instead you should use the region-parameter inside the requests, e.g. when geocoding
Solution 2:
If you're trying to dynamically load a new script for your page based on a user selection then you might want to take a look at getScript. Just trying to change the value of that element wouldn't make a different because it's already been loaded for your page.
Actually, if your desired script is entirely dependent on the user selection in the dropdown I would suggest removing it from the page entirely and just loading it after the user makes a choice only.
Post a Comment for "Dynamically Change Google Maps Script Src With Select"