Javascript examples for jQuery:Link
Passing JavaScript variable in clickable link
<html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script> <script type="text/javascript"> $(document).ready(function () { var codes = window.location.href; codes= codes.substr(codes.lastIndexOf('/')+1); var finalurl = "http://your url/" + codes; $('#links').attr('href', finalurl); });/*from ww w . j a v a 2 s . co m*/ </script> </head> <body> <a id="links" href="https://www.google.co.in/">ChangedNextUrl</a> </body> </html>