How Do You Get the URL Parameters and Append to Href or Src of Another Element?

  • read
  • Add to Flipboard Magazine.

code snippet

Do you want to grab the url parameters and pass them to a button href or iframe src? This is common when you are running a paid ad campaign to a landing page that links to a form on another page. You want to track the source of the form submission by duplicating the url parameters on the form page. Below is the code to help you do that dynamicly.

HTML

JavaScript

 

bootstrap 4 books

Want a Bootstrap Reference Book?

Learn More

Advertise Here

Written by: Jacob Lett - Jacob is an experienced HubSpot website designer and developer who helps Industrial companies increase revenue by improving their website for awareness, lead generation, and branding.
Category: Code Snippets
Tags:

Want to Get Email Updates?

Receive a monthly digest of new tutorials and resources.

Advertise Here