Skip to content
Advertisement

Change script “src” by URL param and make it functional

I am thinking if it’s possible for doing this on a static website,
I have the link of

JavaScript

and the main HTML is

JavaScript

Now, I wanna make it to update according to the URL Param, I’ve got a URL Param (and update the code above) by

JavaScript

The txt files are in the format of

JavaScript

However, the trouble I’m having is that, the src tag updated AFTER loading and the content is simply not updating, possibly because of the scripts not in order, however I’m not having much knowledge on this, anyone could help with a solution on this?

Advertisement

Answer

I think you should remove the script tag and re-add the updated one.

JavaScript
Advertisement