Depending on the type of animations and actions you have in your site, you might be interested in having an anchor link perform some kind of animation that finishes before opening the link in the href attribute. For example, I’m currently working on a site that has a colored box behind the navigation link of the current page. Then when another link in the navigation is clicked, the colored box slides to be behind that link. So I wouldn’t want the url for that second navigation link to open until the colored box is done moving. I’ll cover two ways to do this.
And here’s the anchor html code that would be used:
< a id="link1" class="link" onclick="return validate(link1)" name="link1" href="http://www.google.com/" target="_blank">Google< / a>
And here’s what the anchor HTML code would look like:
< a class="link" href="http://www.google.com/" target="_blank">Google< / a>
You can see how it would be much easier to not have to maintain unique IDs for each link that you want to open. The “live” function of JQuery takes care of every anchor that has a class of “link” applied to it. The other nice thing about this is that if you click the link with your middle mouse button to force it to open into a new page or tab, it will do so right away without waiting for animations or anything.