【发布时间】:2015-10-14 07:34:00
【问题描述】:
我正在尝试从网站http://www.snapdeal.com/product/samsung-galaxy-grand-duos-i9082/638689?HID=productGrid_mobiles_1 的下拉列表中选择一个值
使用的代码:
var obj = document.getElementById('attribute-select-0');
obj.options[1].selected = true;
如果您从下拉列表中手动选择,您将看到下面 div 的 href 和其他属性会随着您更改下拉列表值而发生变化
console.log(document.getElementById('BuyButton-1').href);
ISSUE 我面临的问题是我使用上面提到的代码选择下拉值,但仍然没有在 console.log(document.getElementById( 'BuyButton-1').href);
编辑也试过了:
obj.selectedIndex = 'White';
但结果相同。
不知道我哪里做错了
【问题讨论】: