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

  • read

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 digital marketing and web design consultant who helps businesses 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:

Advertise Here