【发布时间】:2018-01-12 01:59:24
【问题描述】:
当用户从列表框中选择一个项目时,焦点仍然存在,所以如果他按下“回车”,它仍然存在。我想在pick之后自动改变焦点。
我正在使用这个 jquery 函数:
$(function() {
$("nextStep").focus();
});
"nextStep" 是按钮的类,它可以工作,但我想在组合框 aria-expanded 的属性为 false 时实现它。你能解释一下我该怎么做吗?
这是列表框:
<button type="button" class="btn dropdown-toggle btn-default"
data-toggle="dropdown" role="button" data-id="tn_workType"
title="Disoccupato" aria-expanded="false">
<span class="filter-option pull-left">Disoccupato</span>
<span class="bs-caret">
<span class="caret"></span>
</span>
</button>
这是下一步按钮:
<a href="javascript:void(0)" class="btn btn-white btn-rounded nextStep"
tabindex="0">Avanti →</a>
【问题讨论】:
-
如果
nextStep是一个类,那么它不应该是$(".nextStep").focus()
标签: jquery html class listbox focus