问题描述
我有两个相关的下拉列表。
I have two related dropdowns.
当用户从第一个下拉列表中选择一个选项时,第二个下拉列表中包含所有选项的列表没有选择的第一个下拉列表。
When the user selects an option from the first drop down, the second drop down is populated with a list of all the options from the first drop down that were NOT selected.
我正在尝试使用jQuery来获取所有未选择的选项,但我仍然是一个jquery新手,必须
I'm trying to use jquery to get all the not selected options, but I'm still a jquery newb and must be mising something.
我正在尝试以下操作:
$('#segmentCrossStreet1:not(:selected)')
这是segmentCrossStreet1第一下降。这似乎没有返回任何有用的东西。我做错了什么?
This is where "segmentCrossStreet1" is the ID of the first drop down. This doesn't appear to return anything useful. What am I doing wrong?
推荐答案
小提琴: (这个小提琴还显示了如何播放另一个< select>
)
您必须选择< option>
元素,而不是选择的选择>
元素:
You have to select the <option>
elements, rather than the "selected <select>
" elements:
$('#segmentCrossStreet1 option:not(:selected)');
这篇关于从下拉列表中获取未使用jquery选择的值列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!