jQuery(document).ready(function () { var $downsell = jQuery('div.element p').children('a'), $durl = $downsell.attr('href');//retrieve href from
var $address = window.location.href;//get url in window browser var $param = $address.replace('http://www.somedomain.com', '');//throw away the domain host if ($param != '') { $downsell.attr('href', $durl + $param);//combine the old link with the new one } console.log($param);//check the result using web developer console });