如果选择了2个选项中的任何一个,则GreaseMonKey脚本要更改下拉选项



所以,我有一个表格,可以接受值,并在提交时将值附加到多个选项卡中的另一个表单。

如果用户选择或ES。

这是我的greasemonkey:

var taxcty = document.getElementById("CountryCode");
if (taxcty.options[taxcty.selectedIndex].value == 'IT' || 'ES'){
  (document.querySelector && document.querySelector('select[name="currentState"]') || []).value = 'Unverified';
}

因此,从理论上讲,如果用户在" countrycode"字段中选择它或ES,我希望CurrentState字段更改为"未验证"。

它现在正在部分工作,但也正在将所有其他国家代码更改为未经验证的大声笑。因此,如果我选择了" GB",它实际上会更改为未经验证,但我只希望它为此做或ES。

if (taxcty.options[taxcty.selectedIndex].value == 'IT' || taxcty.options[taxcty.selectedIndex].value == 'ES'){

您需要对所有值进行比较的两面。" ES"作为独立操作数将永远是正确的,因为它不是空,空还是错误。

最新更新