我无法修改此 HTML:
<li data-corners="false" data-shadow="false" data-iconshadow="true" data-rapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c">
<div class="ui-btn-inner ui-li">
<div class="ui-btn-text">
<a class="make-inline ui-link-inherit" href="#">
<h3 class="ui-li-heading"> Attending:
</h3>
</a>
<div class="ui-select">
<a href="#" role="button" id="undefined-button" aria-haspopup="true" aria-owns="undefined-menu" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-icon="arrow-d" data-iconpos="right" data-theme="c" data-inline="true" data-mini="false" class="ui-btn ui-btn-up-c ui-btn-inline ui-shadow ui-btn-corner-all ui-fullsize ui-btn-icon-right ui-disabled" aria-disabled="true">
<span class="ui-btn-inner ui-btn-corner-all">
<span class="ui-btn-text"> Maybe </span>
<span class="ui-icon ui-icon-arrow-d ui-icon-shadow"> </span>
</span>
</a>
<select class="attending 310 mobile-selectmenu-disabled ui-state-disabled" data-inline="true" data-native-menu="false" tabindex="-1" disabled="disabled" aria-disabled="true">
<option value="2"> Yes </option>
<option value="0"> No </option>
<option value="1"> Maybe </option>
</select>
</div>
</div>
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"> </span>
</div>
</li>
select标记包含 class= " attending",这是该特定页面所独有的,因此我使用它来访问这部分代码。最终,我尝试使用 class="ui-icon-arrow-r"访问最后一个span标签,这样我就可以设置它的样式。我试过像这样使用jQuery:
$(".attending").parent().find(".ui-icon-arrow-r").css('background-color','yellow');
它不起作用。当我删除 find() 部分时,它会选择页面上的所有 li 元素。所以,我知道那部分正在工作。但是 find 部分不是,我不知道为什么不。如何选择这个元素?