我想将其中一个更改为另一个选项,并自动禁用其他选择框!
<select name="SELECT[0]">
<option selected value="01">text1</option>
<option value="02">text2</option>
<option value="03">text3</option>
<option value="04">text4</option>
<option value="nn">textn</option>
</select>
<select name="SELECT[1]">
<option selected value="01">text1</option>
<option value="02">text2</option>
<option value="03">text3</option>
<option value="04">text4</option>
<option value="nn">textn</option>
</select>
<select name="SELECT[2]">
<option selected value="01">text1</option>
<option value="02">text2</option>
<option value="03">text3</option>
<option value="04">text4</option>
<option value="nn">textn</option>
</select>
<select name="SELECT[3]">
<option selected value="01">text1</option>
<option value="02">text2</option>
<option value="03">text3</option>
<option value="04">text4</option>
<option value="nn">textn</option>
</select>
<select name="SELECT[n]">
<option selected value="01">text1</option>
<option value="02">text2</option>
<option value="03">text3</option>
<option value="04">text4</option>
<option value="nn">textn</option>
</select>
答案 0 :(得分:0)
关键是the "selection" type attribute of jQuery's .not
method。
$("select").change(function () {
$("select").not($(this)).attr("disabled", "true");
});