0

我们希望按顺序对人员进行排名,但不希望多次选择相同的选项:

Person Number 1
<select name="person1">
<option value="null">Please Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

Person Number 2
<select name="person2">
<option value="null">Please Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

Person Number 3
<select name="person3">
<option value="null">Please Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

因此,在这里,如果有人在第一人称框中选择选项 1,则所有选项框都将重新填充,并删除(或禁用)该选项。

显然,第一个选项 - null '请选择一个选项' 必须被忽略。

我还需要某种“重置”功能吗?

不知道从哪里开始,有什么想法吗?

谢谢!

4

1 回答 1

1

If I understand correctly, you have N persons that you want to rank from 1 to N (there's nobody left out of the ranking).

If JavaScript components are an acceptable option for your context, then I would suggest you use the «Sortable» component :

http://jqueryui.com/sortable/

It could give a better user experience than having multiple "select" elements.

EDIT : Ok I see from the comments that you really want to use N "select". As suggested by Flea777 you should look at the .change() event of JQuery, and set the "disabled" attribute on the "option" entries which have already been selected : http://www.w3schools.com/tags/att_option_disabled.asp

于 2013-10-03T13:28:04.773 回答