daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <a href="home" id="relurl" target="_blank" title="This is a relative link!">link</a>
  2.    
  3. var x = window.location.href; // Current page URL
  4. var link = document.getElementById("relurl"); // store the element
  5. var curHref = link.getAttribute('href'); // Get HREF paramter
  6. link.setAttribute('href', x + "/"+ curHref);
RAW Paste Data
Top