Changing a links href after click with jQuery - Javascript jQuery

Javascript examples for jQuery:Link

Description

Changing a links href after click with jQuery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from  w ww. j a  va 2  s  .c  o m*/
rwt = function(e){
    e.href = $(e).data('wpurl');
}
    });

      </script> 
 </head> 
 <body> 
  <a href="http://google.com" rel="group" data-wpurl="http://yahoo.com" onmousedown="rwt(this)" target="_blank">CLICK HERE</a>  
 </body>
</html>

Related Tutorials