Revision: 37604
Updated Code
at February 23, 2012 23:10 by digitalclubb
Updated Code
$('a.ext').each(function() {
var $self = $(this), extTitle;
if ($self.attr('title') !== undefined && $self.attr('title') !== "") {
extTitle = $self.attr('title');
$self.attr('title', extTitle + ' (opens in a new window)');
} else {
$self.attr('title', 'This link will open in a new window');
}
}).bind({
'click':function() { window.open($(this).attr('href')); return false; },
'keypress':function(e) { if (e.keyCode == 13){window.open($(this).attr('href')); return false;} }
});
Revision: 37603
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 13, 2010 21:26 by digitalclubb
Initial Code
$('a.ext').each(function() {
if ($(this).attr('title') !== undefined && $(this).attr('title') !== "") {
var extTitle = $(this).attr('title');
$(this).attr('title', extTitle + ' (opens in a new window)');
} else {
$(this).attr('title', 'This link will open in a new window');
}
}).bind({
'click':function() { window.open($(this).attr('href')); return false; },
'keypress':function(e) { if (e.keyCode == 13){window.open($(this).attr('href')); return false;} }
});
Initial URL
Initial Description
The most annoying thing I find working with the strict doctype is the inability to send users off to a site in a new window. To combat this, I always use the above snippet. Some people just stick the attribute on the anchors when the page loads, however for semi-accessibility, I think this works well.
Initial Title
XHTML Strict Anchor jQuery Fix
Initial Tags
xhtml, jquery
Initial Language
jQuery