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

 

Written by: Jacob Lett - Jacob is a marketing and web design consultant who helps manufacturers grow their revenue. Unlike his competitors, he focuses on small and consistent website design changes to increase results. He recently created the Industrial HubSpot Theme to help manufacturers quickly build their website on the HubSpot platform.
Category: Code Snippets
Tags:

Want to Get Email Updates?

Receive a monthly digest of new tutorials and resources.

The Artistic Side of web design 1

Advertise Here