0

我正在尝试使用 javascript 更改组合框中的选定项目,但它看起来不像 HTML 中的普通下拉列表。我试图在网上找到答案,但只为不同类型的下拉列表找到了答案。感谢任何帮助我的人。

这是代码:

<span class="widget-wrapper" >
<span class="off-screen module-js-ignore" id="dropdown_aria_label_1">
<span>Select Quantity</span>
<!--[if lte IE 8]><span class="dropdown-ie-value module-js-ignore">__</span><![endif]-->
</span>
<span class="widget-theme margin10R " id="quantity_select" style="" role="application">

<span tabindex="0" class="widget-dropdown module-js-ignore" role="combobox" aria-expanded="false" aria-labelledby="dropdown_aria_label_1" aria-describedby="dropdown_current_value_1" aria-valuetext="__" aria-owns="dropdown_aria_list_1" aria-haspopup="true"><!--[if lte IE 7]><span class="off-screen dropdown-ie-value module-js-ignore">__</span><![endif]--><span><b><b class="widget-default-color dropdown-selected-label module-js-ignore" style="" aria-live="assertive" id="dropdown_current_value_1" role="status">__</b></b></span></span>
<div class="dropdown-options-form " style="display:none;position:absolute;z-index:100">

<ul class="widget-dropdown-list module-js-ignore" id="dropdown_aria_list_1" role="listbox">



    <li tabindex="0" class=" dropdown_default_option " role="option" aria-disabled="false" aria-selected="true" data-value=""><span class="dropdown_option_text dropdown_option_selected_text">__</span></li>


    <li tabindex="0" class="" role="option" aria-disabled="false" aria-selected="false" data-value="1"><span class="dropdown_option_text dropdown_option_selected_text">1</span></li>


    <li tabindex="0" class="" role="option" aria-disabled="false" aria-selected="false" data-value="2"><span class="dropdown_option_text dropdown_option_selected_text">2</span></li>


    <li tabindex="0" class="" role="option" aria-disabled="false" aria-selected="false" data-value="3"><span class="dropdown_option_text dropdown_option_selected_text">3</span></li>


    <li tabindex="0" class="" role="option" aria-disabled="false" aria-selected="false" data-value="4"><span class="dropdown_option_text dropdown_option_selected_text">4</span></li>


    <li tabindex="0" class="" role="option" aria-disabled="false" aria-selected="false" data-value="dd_template"><span class="dropdown_option_text dropdown_option_selected_text">dd_template</span></li>


</ul>

</div>

4

1 回答 1

0

使用以下过程:

  • 查找具有该属性的元素aria-selected="true"
  • 将其更改aria-selected="true"aria-selected="false"
  • 找到事件的目标
  • 将其更改aria-selected="false"aria-selected="true"
于 2013-10-18T23:59:36.243 回答