跟随jQuery UI标签中标签的链接 [英] Follow the links of the tab in jquery ui tab
问题描述
我有类似jquery的标签
I have jquery tabs like
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a href="#tab-2">Name 2</a></li>
<li><a href="http://www.google.com/">Name 3</a></li>
</ul>
<div id="tab-1">content 1</div>
<div id="tab-2">content 2</div>
前两个标签会加载相应的div.但是第三个应该转到google.com,而不执行任何操作.它只是添加 http://example.com/index.html #ui-tabs- [对象对象] 网址.
the first two tabs load the respective divs. But the third one should go to google.com, instead it does nothing. It just adds http://example.com/index.html#ui-tabs-[object Object] to the url.
我正在开发一个wordpress插件,管理页面需要一个选项卡界面.我在本地服务器上对此进行了测试,但无法正常工作
I am developing a wordpress plugin and the admin page needs a tab interface. I tested this in a local server and not working
更新:
我不想在页面内加载google.com.它应该像普通链接一样在新的标签/窗口中打开网页.
i don't want to load google.com inside the page. It should open the webpage in new tab/window like ordinary links do.
推荐答案
当我看到生成的源代码时,
When i saw the generated source code, the
<li><a href="http://www.google.com/">Name 3</a></li>
已更改为
<li><a href="#ui-tabs-[object Object]">Name 3</a></li>
但其他列表相同.我仍然不知道是否是由于本地服务器中的测试问题所致.
But other lists were same. I still don't know whether it is due to the problem of testing in local server.
所以我尝试了这个选项.我删除了"href"属性,并添加了一个名为"theLink"的类,如
So i tried this option. I removed the "href" attribute and added a class named "theLink" like
<li><a class="theLink" target="_blank">Name 3</a></li>
然后我添加了以下jquery
and then i added the following jquery
$('.theLink).attr('href', 'http://www.google.com');
在此之后,它按我的方式工作.点击后的第三个标签将google.com加载到新标签中
after this it worked as i excepted. The third tab when clicked loaded google.com in a new tab
这篇关于跟随jQuery UI标签中标签的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!