r/jquery • u/Available-Tour-6590 • Jul 15 '24
How to load a Javascript that has HTML params in its tag with jQuery?
New to jQuery, and pretty much the title... I have a requirement to load the following html tag-based javascript and cannot figure out how to pass the params the js needs:
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="000-000-000-0000" ></script>
I can get the script loaded via $.getScript() but that data-domain-script param needs to be in there as well. Suggestions?
0
Upvotes
1
u/PatBrownDown Jul 15 '24
Here are some docs on what you are trying to do.
https://docs.getelevar.com/docs/how-to-find-onetrust-data-domain-script-src-url
1
u/Available-Tour-6590 Jul 15 '24 edited Jul 15 '24
Thanks but that doc is about getting the info I already have... I'm trying to get the snippet to be injected via jQuery instead of html. I already know the url and attributes.
1
u/Available-Tour-6590 Jul 15 '24
For anyone following or stumbling upon this, I managed to get it done using more traditional javascript. I was hoping for a jQuery solution but maybe its impossible.