I’d like to use JS or JQuery to grab a specific URL parameter and append it to an IMG SRC tag I have embedded in a custom code block on my landing page. Example below:
Example URL – https://www.example.com/page?utm_source=test&[email protected]
Desired IMG SRC – <img src="https://www.example.com/[email protected]">
I’ve combed through a couple of articles that present similar solutions (usually the image src URL itself), but I haven’t been able to get it to work – just out of my depth.
Thank you.
2
Answers
Considering this is our URL: https://www.example.com/page?utm_source=test&[email protected]";
With the help of danish’s answer: