I have a URL that I want to link to with a few different URLSearchParams that will update a string of text within the HTML.
My URLs will be like:
example.com?code=GreenMonkey
example.com?code=PinkPanda
example.com?code=BlueCat
Then I will have some JS in the HTML:
const params = new URL('https://example.com?code=GreenMonkey').searchParams;
params.get('code');
Then I want to change a string of text within the HTML:
<div class="code">Change this text based on the 'code' param.</div>
For example:
If 'code' param = GreenMonkey > change string to "Hello world"
If 'code' param = PinkPanda > change string to "Goodbye world"
If 'code' param = BlueCat > change string to "Aloha world"
I'm stuck on how to achieve the last part. Any direction would be appreciated!