根据jQuery中的当前值更改选项值

我有以下HTML:

 Gallery Feature Thumbnail  

这是动态生成的,并为每个项目重复。 由于只能有一个特征图像,所以每当选择一个新图像作为“特征”时,我想重置任何标记为“特征”的选项值。

我试过这个jQuery但它似乎没有响应:

 current.find(".file_image_type option[value='Feature']").val("Gallery"); 

我可以使用以下function将图像设置为function:

 current.find(".file_image_type").val("Feature"); 

人,人,你不需要直接在jQuery中选择option 。 我无法相信有多少次我看到这个错误。

 $('.file_image_type').change(function() { $('.file_image_type').not(this).each(function() { var $this = $(this); if ($this.val() === 'Feature') { $this.val('Gallery'); } }); });​ 

“Gallery”不是val() ,而是text()