Javascript,更改组合框中的选定项
我正在尝试使用javascript更改组合框中的选定项,但它看起来不像HTML中正常的下拉列表。我曾试图在网上找到答案,但只在不同的下拉列表中找到了答案。谢谢所有帮助我的人 代码如下:Javascript,更改组合框中的选定项,javascript,html,drop-down-menu,combobox,wai-aria,Javascript,Html,Drop Down Menu,Combobox,Wai Aria,我正在尝试使用javascript更改组合框中的选定项,但它看起来不像HTML中正常的下拉列表。我曾试图在网上找到答案,但只在不同的下拉列表中找到了答案。谢谢所有帮助我的人 代码如下: <span class="widget-wrapper" > <span class="off-screen module-js-ignore" id="dropdown_aria_label_1"> <span>Select Quantity</span> <
<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>
选择数量
__
使用以下过程:
- 查找具有属性的元素
aria selected=“true”
- 将其
更改为aria selected=“true”
aria selected=“false”
- 找到事件的目标
- 将其
更改为aria selected=“false”
aria selected=“true”