Change the location.href property dynamically through jQuery - Javascript jQuery

Javascript examples for jQuery:Link

Description

Change the location.href property dynamically through 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://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*from w  ww  . j a  va  2s . c o m*/
$('#home').attr("href" , "home.php");
    }

      </script> 
   </head> 
   <body> 
      <a id="home" href="before">Change Me</a>  
   </body>
</html>

Related Tutorials