首页 > 解决方案 > 在网站的移动版本中选择一个选项(响应模式)

问题描述

当我以响应模式浏览它时,如何从https://www.supremenewyork.com/mobile#products/305278中选择尺寸选项?我试过了,document.querySelector("#size-options > option:nth-child(2)").selected = "selected";但它不起作用。

在桌面模式下https://www.supremenewyork.com/shop/pants/n1to4psjk/wlmx7p5hr该方法document.querySelector("#size > option:nth-child(3)").selected = "selected";按预期工作。

标签: javascripthtmldomresponsive-designhtml-select

解决方案


您可以使用 document.querySelector("#order_billing_country").value = "countryCode"; 它,它可以在桌面和移动设备上运行。移动端的 UI 永远不会更新,但是当你按下流程支付时,正确的值会发送给 Supreme。


推荐阅读