We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Question

Opening external links in a new tab


I'm trying to create a way that I can open external links in a new tab on my website.

When I add a link in the text-box there is now way to add a "target="_blank" option. I have been trying to use JQuery and have inserted the following code into my header:


Has anyone else come up against this problem and got around it?


Orla Kirwan

Orla Kirwan 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does your code not work? What happens?

Hi Drew,

Sorry - yeah the code doesn't work. Still opens in the same window!

Here's a link to the page I'm trying to get working. External links on right hand side: http://www.moatepetclinic.ie/petcare.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you open your browser console, you'll see an error that jQuery is not defined. That's because you're trying to use jQuery before it's been added to the page.

Move your code down to the bottom of the page, after the point jQuery is included.

Ah that's what's going on - thanks for pointing that out. It's all working perfectly now ;)

Cheers, Orla