December 2013
Intermediate to advanced
384 pages
9h 54m
English
<script> $("#pageLink").attr("href", "complexpage.html"); </script . . . <body> <a id="pageLink" href="simplepage.html">Link</a> </body>
With web pages becoming more and more dynamic, even the links that are built into have become dynamic. A great advantage of using jQuery and JavaScript in your pages is that you can easily alter the URL that links point to dynamically based on user input or other sources of data.
To change the URL that a link points to, use the .attr("href", newURL) method. When the user clicks on the link, the browser reads the href attribute of the <a> element and then loads that location as the next page.
Read now
Unlock full access