In certain conditions I want to open links in the same window, while in others I want to open them in a new window. I have the following jQuery code:
if (internal) {
jQuery(".main a").removeAttr('target');
} else {
jQuery(".main a").attr('target', '_blank');
}
I have two <a>
s contained in the "main" div. One is directly under the div while the other is buried under a couple of sub-divs. When it runs, it only adds the blank target to the first <a>
tag. However, when I set a breakpoint through Firebug and step through it, everything works fine. Is there a reason it wouldn't work at full speed? What's the workaround?