MVC去特定的标签使用Jquery [英] MVC go to specific tab using Jquery
本文介绍了MVC去特定的标签使用Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在.NET MVC 4和这样做;
我已经使用标签
I am doing this in .net MVC 4 & I have made tabs using
<div id="tabs">
<ul>
<li><a href="#tab-1">Tab 1</a></li>
<li><a href="#tab-2">Tab 2</a></li>
<li><a href="#tab-3">Tab 3</a></li>
<li><a href="#tab-4">Tab 4</a></li>
</ul></div>
我想在例如在一个特定的标签去(表4),
我用这行code,但没有成功,
这里(BTN)
是链接被点击的时候类。
I want to go in a specific tab for example in (Tab 4),
I am using this line of code but no Success,
here (".btn")
is the class when the link is clicked.
<script type="text/javascript">
$(".btn").click(function () {
$("#tabs").tabs('select', "#tab-4");
});
</script>
我也用了一些事情是这样的: $(#标签),标签({选项,,3});
请告诉我raight办法摆脱这一点。
Please tell me the raight way to get rid of this.
推荐答案
从文档,您正在寻找的选项的活跃:
From the docs, the option you are looking for is active:
{活跃:指数}
其中,首页
是一个从零开始的索引。所以,你的code必须是:
Where index
is a zero-based index. So your code needs to be:
$(".btn").click(function () {
$("#tabs").tabs({ active: 3 });
});
下面是一个小提琴以上。
这篇关于MVC去特定的标签使用Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文