jQuery - External links (problems)
Posted: Sun Mar 25, 2007 3:00 pm
Hmph. Well, I never did like javascript, but jQuery is pretty cool.
Anyway, I'm marked up as XHTML 1.1. So, no target attribute. I have a link I want to open in a new window. For some reason, my jQuery isn't working quite right. It does open in a new window, but it opens a local page /undefined.
Instead of opening blahblahblahexternal.com, it opens mysite.com/currentfolder/undefined.
Anyway, I'm marked up as XHTML 1.1. So, no target attribute. I have a link I want to open in a new window. For some reason, my jQuery isn't working quite right. It does open in a new window, but it opens a local page /undefined.
Code: Select all
$(document).ready(function(){
$("a[@rel='external']").click(function() {
window.open(this.href);
return false;
});
});Code: Select all
<a href='http://blahblahexternal.com/' rel='external'>text</a>