Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何循环一组ID并匹配活动元素';jQuery中另一组元素的属性?_Javascript_Jquery_Html - Fatal编程技术网

Javascript 如何循环一组ID并匹配活动元素';jQuery中另一组元素的属性?

Javascript 如何循环一组ID并匹配活动元素';jQuery中另一组元素的属性?,javascript,jquery,html,Javascript,Jquery,Html,我试图循环一组元素的ID,并将其与另一组元素的属性(aria labelledby)进行匹配,但前提是它是活动面板,并且我无法找到解决方案 $('body a').mouseenter(函数(){ e=$(本); btnClass=e.attr('class'); 交换机(btnClass){ “导航链路”案例: tabID=$(this.attr('id'); paneID=$('#v-pills-tabContent')。children(); paneID.each(函数(索引){ lo

我试图循环一组元素的ID,并将其与另一组元素的属性(aria labelledby)进行匹配,但前提是它是活动面板,并且我无法找到解决方案

$('body a').mouseenter(函数(){
e=$(本);
btnClass=e.attr('class');
交换机(btnClass){
“导航链路”案例:
tabID=$(this.attr('id');
paneID=$('#v-pills-tabContent')。children();
paneID.each(函数(索引){
log(index+”:“+$(this.prop('id'));
});
打破
}
});
.nav链接{
显示:块;
文字装饰:无!重要;
填充:14px;
边框底部:1px实心#eff1f2;
颜色:#7474;
}
#v-药片-表a:最后一个孩子{
边界底部:0;
}
.tab内容>.active{
不透明度:1;
}
.col-3、.col-9{
浮动:左;
}
.col-9{
宽度:250px;
}
上校3{
边框:1px实心#eff1f2;
}
#v-TABP含量{
边缘底部:18px;
}
.day num、.day name、.month name、.year name{
显示:块;
文本对齐:居中;
}
.day num、.month name、.schedule头{
字号:28px;
}
.日名,.年名{
字体大小:14px;
}
.附表标题{
显示:块;
文本对齐:居中;
线高:3.2米;
}
.无线链路{
填充:10px 20px;
位置:相对位置;
}
.电台时刻表{
宽度:18px;
高度:18px;
背景:#fff;
边框:2px实心#eff1f2;
边界半径:50%;
显示:内联块;
边界半径:25px;
裕度:0 10px 0 0;
位置:绝对位置;
左-6px;
顶部:8px;
}
.选项卡内容。无上页边距{
页边距顶部:0!重要;
}
.tab内容>.tab窗格{
边缘顶部:22px;
}

2017年10月
计划表


每个活动选项卡都应该有
.active
类。

如果是这样,在
switch
语句中可以使用
$('.tab pane.active').attr('aria-labelledby'))
获取
aria labelledby
值。

如果要查找
#v-pills-tabContent
的子元素,其属性
aria labelledby
等于单击的
a
元素的
id
,则应执行以下操作:

tabID = $(this).attr('id');
paneID = $('#v-pills-tabContent')
             .children('[aria-labelledby="' + tabID + '"].active')

选择器
“[aria labelledby=“”+tabID+”].active'
将匹配
aria labelledby
等于
tabID

的活动元素。您想找到
#v-pills-tabContent
的子元素,该元素的属性
aria labelledby
等于单击的
a
元素的
id
。@ncardeli是!这正是我想要实现的。如果你知道怎么做,请帮帮我。我会试试看这是不是最好的方法。