我正在使用Wet-boews工具包中的选项卡界面(http://wet-boew.github.io/v4.0-ci/docs/ref/tabs/tabs-en.htm l)
在页面加载后,如何确定哪个Tab已打开。
我尝试了以下但奇怪的是他们都回归真实
var obj = {
"data": {
"VersionForTarget": "1",
"RulesContainer": [//array bracket
"Rule": { // <--- New Rule Goes Here
"RuleParentID": "1",
"RuleVersionID": "1",
"MappedValue": "1",
"ProcessingOrder": "1",
"MetaInsertUtc": "2017-03-03T17:54:34.643",
"Value": "Omaha",
"IsRuleRetired": "0",
"UserImpactCount": "2277",
"AttributeContainer": {
"Attribute": { // <--- New Attribute Goes Here
"AttributeID": "6",
"AttributeName": "Campus",
"AttributeDetailsContainer": {
"AttributeDetails": { // <--- New Attribute Details Goes Here
"RuleDetailID": "1",
"AttributeID": "6",
"OperatorID": "3",
"AttributeValue": "1",
"RuleParentID": "1",
"Value": "Omaha",
"IsValueRetired": "0",
"OperatorName": "In List",
"SqlOperator": "IN"
}
}
}
}
}
]
}
};
答案 0 :(得分:1)
两个提示:
要按id
获取元素,您需要在ID #
$('#details-panel-panel1')
字符
$("#details-panel-panel1").attr("open")
会为您提供属性open
的值,它不会告诉您是否存在(不会是布尔值)。
说,我在文档中找不到任何内容,但我正在查看生成的代码,实际上你无法通过查看open
属性来判断选项卡是否已打开。但我注意到两件事:
aria-expanded
在打开的标签页上为true,其余为false。in
类,其他标签包含out
。你可以采取任何一种方式:
$('#details-panel10').attr('aria-expanded') === "true"
或
$('#details-panel10').hasClass('in') === true