Open New URL from JQuery Tab

Ok, I'm new to Javascript and even newer to JQuery, but am trying to learn both!

I have a webpage where I have implemented JQuery ui Tabs and they are working absolutely fine, using the default function shown below.

However, I have a real need to be able to open a new URL, using one of the tabs, however, I can't see how to do this. I'm sure it's possible, I just don't know how.

I understand I can use AJAX in a tab, but this solution won't work for me, I really need to be able to set the href of a tab to a normal URL and have it open as if the user had clicked on a bog standard link, ie in the existing window, not in a new window.

If anyone can help I'd be extermely grateful!
$(document).ready(function() {
	$(function() {

Open in new window

Who is Participating?
anoyesConnect With a Mentor Commented:
I think the script below should work for you.  It'll open tabs that have a target="_blank" set on their <a> element in a new window.  The only catch is that you still have to precede the URL with a #.  So, for example, this would open in a new window:

<li><a href="#" target="_blank">Google</a></li>

whereas this would behave as usual:
<li><a href="#tab2">Tab 2</a></li>

<script type="text/javascript">
    select: function(event, ui) {
      if ($('target') == '_blank')
        return false;

Open in new window

chuckaliciousAuthor Commented:
Ok, close enough. Your code still opens the link in a new window, which isn't what I'm looking for, however, I changed the code to the following. It now works nicely, so thanks :)


Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.