![](/img/trans.png)
[英]How do I check which radio button is selected when there are multiple radio buttons with the same name? (using jquery)
[英]When two checkboxes are on the same page using the same class name, how do I check the box I want using nightmarejs?
要使用的DOM可能是這兩個之一,它們都與我要檢查的框有關:
<input class="checkbox" type="checkbox" value="1" name="order[terms]" id="order_terms" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;">
要么
<ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
有兩個具有相同類名的復選框,因此使用:
.click('.iCheck-helper')
不起作用,它檢查了錯誤的框。
我想我必須對包裝盒更具體,但是我想出的每種可能性都失敗了。 我通過原子編碼的節點運行程序,並使用nightmarejs作為依賴對象。 我只是想選中正確的框。
您可以將eq
偽選擇器用作選項。
第一個為.click('.iCheck-helper:eq(0)')
,第二個為.click('.iCheck-helper:eq(1)')
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.