带有左类的 div 是通过用户单击添加按钮来克隆的。所以它是多个。
我需要找到所有其他课程的当前值,除了触发此功能的那个[已经在“changed_course”变量中找到值]
<div id="ds_relation_main_block">
<div class="left">
<select name="course[]" class="input-block-level course">
<option value="55" selected="selected">BBA</option>
<option value="56">BSc</option>
<option value="57">BIT</option>
</select> <!-- end of select -->
</div> <!-- end of left -->
<div class="left">
<select name="course[]" class="input-block-level course">
<option value="55" selected="selected">BBA</option>
<option value="56">BSc</option>
<option value="57">BIT</option>
</select> <!-- end of select -->
</div> <!-- end of left -->
<div class="left">
<select name="course[]" class="input-block-level course">
<option value="55" selected="selected">BBA</option>
<option value="56">BSc</option>
<option value="57">BIT</option>
</select> <!-- end of select -->
</div> <!-- end of left -->
<script>
jQuery(function($) {
$('.course').change(function(evt) {
var changed_course = $(this).find('option:selected').val();
//console.log(changed_course);
//need to find all other course's current values
//except the one which triggered this function [ already found the value in //"changed_course" variable ]
});
});