Open link in new window with Jquery
- by mtwallet
Hi. I am trying to open a few links in a new window using Jquery rather than _blank so my html remains valid. My code looks like this:
$(document).ready(function() {
$('a[id="external-url"]').click(function(){
$(this).attr('target','_blank');
});
});
This works just fine except when the link is contained within html I have placed on the page using the Jquery load() method. Can anyone explain why and please help with a solution?