Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arung Isyadi
Added: Apr 13, 2014 5:37 AM
Modified: Apr 13, 2014 5:41 AM
Views: 75
  1. jQuery(document).ready(function () {
  2.     var $downsell = jQuery('div.element p').children('a'),
  3.         $durl = $downsell.attr('href');//retrieve href from <div class="element"><p><a href="some-link"></a></p></div>
  4.     var $address = window.location.href;//get url in window browser
  5.     var $param = $address.replace('http://www.somedomain.com', '');//throw away the domain host
  6.     if ($param != '') {
  7.         $downsell.attr('href', $durl + $param);//combine the old link with the new one
  8.     }
  9.     console.log($param);//check the result using web developer console
  10. });