迭代选择器javascript旁边的所有元素

迭代选择器javascript旁边的所有元素,javascript,jquery,Javascript,Jquery,嗨,我有一个选择框,在不同的元素中有相同的类超级属性选择 <dd class="clearfix swatch-attr" style="display: none;"> <div class="input-box"> <select name="super_attribute[327]" id="attribute327" class="required-entry super-attribute-select no-display swa

嗨,我有一个选择框,在不同的元素中有相同的类超级属性选择

<dd class="clearfix swatch-attr" style="display: none;">
    <div class="input-box">
        <select name="super_attribute[327]" id="attribute327" class="required-entry super-attribute-select no-display swatch-select"
            style="display: none;">
    <option value="">Choose an Option...</option><option value="2178" price="0" data-label="not specified" selected="selected">Not Specified</option></select>
    </div>
</dd>
<dd>
    <div class="input-box field__input-wrapper">
        <select name="super_attribute[481]" id="attribute481" class="required-entry super-attribute-select field__input field__input--select"
            style="pointer-events: none;">
    <option value="">Choose an Option...</option><option value="5531" price="0" data-label="intel core i5">Intel Core I5</option></select>
    </div>
</dd>
<dd>
    <div class="input-box field__input-wrapper">
        <select name="super_attribute[500]" id="attribute500" class="required-entry super-attribute-select field__input field__input--select"
            style="pointer-events: none;">
    <option value="">Choose an Option...</option><option value="5828" price="0" data-label="8 gb ddr3">8 GB DDR3</option></select>
    </div>
</dd>
<dd>
    <div class="input-box field__input-wrapper validation-passed">
        <select name="super_attribute[542]" id="attribute542" class="required-entry super-attribute-select field__input field__input--select validation-passed">
    <option value="">Choose an Option...</option><option value="9396" price="424" data-label="3.3 ghz">3.3 GHz</option><option value="9393" price="300" data-label="3.2 ghz">3.2 GHz -BHD 124.00</option><option value="9628" price="84" data-label="3.1 ghz">3.1 GHz -BHD 340.00</option><option value="9626" price="0" data-label="2.8 ghz">2.8 GHz -BHD 424.00</option></select>
    </div>
</dd>
<dd style="display: block;">
    <div class="input-box field__input-wrapper">
        <select name="super_attribute[543]" id="attribute543" class="required-entry super-attribute-select field__input field__input--select"
            style="pointer-events: none; display: block;">
    <option value="">Choose an Option...</option><option value="9857" price="0" data-label="amd radeon r9 290x">AMD Radeon R9 290X</option></select>
    </div>
</dd>
<dd class="last">
    <div class="input-box field__input-wrapper">
        <select name="super_attribute[629]" id="attribute629" class="required-entry super-attribute-select field__input field__input--select"
            style="pointer-events: none;" disabled="">
    <option value="">Choose an Option...</option><option value="13288" price="0" data-label="1 tb">1 TB</option></select>
    </div>
</dd>
我正在使用.each在更改任何选择值时迭代这些选择框

但我只想在更改选择之后出现的选择框上迭代,而不是从开始到结束在所有选择上迭代。例如,如果我更改了第三个选择框,循环迭代必须从第三个开始,而不是从第一个开始。我尝试了
.nextAll()
,但它只在兄弟姐妹上迭代,在我的情况下不起作用

你可以这样做

jQuery(this).closest('dd').nextAll('dd').find('.super-attribute-select');

所以dd兄弟姐妹不是('.super attribute select')这怎么行呢?我编辑了我的答案。我得到了第一个带有with dd标记的父元素,然后我得到了所有具有相同标记的下一个同级元素,我在结果中找到了所有具有超级属性select classYes的元素,您可以使用每个元素循环元素Hanks得到了它…:)
jQuery(this).closest('dd').nextAll('dd').find('.super-attribute-select');