Javascript或jQuery选择器从'a',然后到使用类的多个div
我有这样的htmlJavascript或jQuery选择器从'a',然后到使用类的多个div,javascript,jquery,html,Javascript,Jquery,Html,我有这样的html <a href="/portal/product/62157993" id="ember1708" class="product-items__item ember-view"> <div id="ember1709" class="product-item product-view-item ember-view"> <div class="product-item__info"> <div class="
<a href="/portal/product/62157993" id="ember1708" class="product-items__item ember-view">
<div id="ember1709" class="product-item product-view-item ember-view">
<div class="product-item__info">
<div class="product-item__name">
<span data-ember-action="" data-ember-action-1712="1712">Pashmina Denim</span>
</div>
<div class="product-item__promote">
<!---->
<div id="ember1713" class="product-boost-button ember-view">
<div id="ember1714" class="shopee-button shopee-button--inactive shopee-button--medium ember-view"> Promote
</div>
</div>
</div>
</div>
</div>
</a>
如何解决此问题?如果要选择
如果要选择
看起来像是ember,为什么要这样附加click事件,而不是遵循ember的指导原则?为什么要尝试单击div元素?div没有点击行为,除了你通过JS添加的内容外,你不应该通过JS添加任何内容,因为对于不能使用鼠标的人来说,这是一个可访问性失败的问题。带类的div shopee button是button@nnnnnn,所以你说它可以通过键盘访问,即使它是一个div元素?我只想用类来单击这个div,因为id的random@azs06看起来像是ember,为什么要用这种方式附加click事件,而不是遵循ember的指导方针?为什么要尝试单击div元素?div没有点击行为,除了你通过JS添加的内容外,你不应该通过JS添加任何内容,因为对于不能使用鼠标的人来说,这是一个可访问性失败的问题。带类的div shopee button是button@nnnnnn,所以你说它可以通过键盘访问,即使它是一个div元素?我只想用类来单击这个div,由于id为random@azs06Perfect:),我被修改为document.querySelector('a[href=“/portal/product/62157993”].product-item_uupromote.shopee按钮')代码>因为我有更多的链接。谢谢完美:),我被修改为document.querySelector('a[href=“/portal/product/62157993”].product-item_uu-promote.shopee按钮')代码>因为我有更多的链接。非常感谢。
var aTags = document.querySelectorAll("a[href='/portal/product/62157993'],div[class='product-item'],div[class='product-item__info'],div[class='product-item__promote'],div[class='product-boost-button]',div[class='product-boost-button]',div[class='shopee-button]'");