【发布时间】:2012-11-01 04:33:07
【问题描述】:
我的页面看起来像这样,根据所选标签的索引,保存按钮的行为需要有所不同。
这是 jQuery 代码。
$("#btnSave").click(function () {
var selectedTabIndex = $('#TabStrip').select().index()
if (selectedTabIndex == 1) {
InflowsSave();
}
if (selectedTabIndex == 2) {
OutflowsSave();
}
});
我在 Inspect Elements 控制台中输入了 $('#TabStrip').select().index()。选择哪个选项卡无关紧要,它总是返回 2。
>>> $("#TabStrip").select().index()
2
$("#TabStrip").select()
<ul class="t-reset t-tabstrip-items">
<div id="TabStrip-1" class="t-content">
<div id="TabStrip-2" class="t-content t-state-active" style="display:block">
<div id="TabStrip-3" class="t-content">
【问题讨论】:
-
你在使用 Telerik Extensions for ASP.NET MVC 或 Kendo UI Wrappers for ASP.NET MVC 吗?
-
我正在使用 ASP.NET MVC。谢谢。
标签: javascript jquery asp.net-mvc telerik