网站上有几个select
循环显示:
$(".selectOptions").change(function() {
var href = $(".selectOptions :selected").val();
console.log(href);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select size="6" class="color form-control ocf-target selected selectOptions" name="color">
<option class="ir_Все" value="http://.../index.php?route=product/category&path=59" id="v-cancel-1">Все</option>
<option class="ir_3597ae" value="" id="v-12" disabled="disabled">Синий</option>
<option class="ir_ffffff" value="http://.../index.php?route=product/category&path=59&filter_ocfilter=1:22" id="v-122">Белый</option>
</select>
<select size="6" class="color form-control ocf-target selected selectOptions" name="color">
<option class="ir_fbaf00" value="http://.../index.php?route=product/category&path=59&filter_ocfilter=1:3" id="v-13" selected="selected">Желтый</option>
<option class="ir_ff0000" value="" id="v-11" disabled="disabled">Красный</option>
</select> ...
选择字段时,需要获取该字段的值。但由于某种原因,它仅从 first 中获取值select
。
1 个回答