2

我有一个带有复选框的 div,每次在检查其中任何一个之前,我都想确保先清除它们。关于我如何做到这一点的任何意见?

由复选框组成的 div 的 HTML 代码是

<div class="row_bus_groups cuke_business_group">
<div class="row">
<input class="field_checkbox cuke_partners" type="checkbox" id="SelectedBusinessGroups[0]" name="SelectedBusinessGroups[0]" value="Partners">
<label for="SelectedBusinessGroups[0]"><span class="translated_text" rel="BusinessGroups.Partners">Partners</span></label>  
<input type="hidden" name="SelectedBusinessGroups[0]" value="">
</div>                                          
<div class="row">
<input class="field_checkbox cuke_press" type="checkbox" id="SelectedBusinessGroups[1]" name="SelectedBusinessGroups[1]" value="Press">
<label for="SelectedBusinessGroups[1]"><span class="translated_text" rel="BusinessGroups.Press">Press</span></label>  
<input type="hidden" name="SelectedBusinessGroups[1]" value="">
</div>                                          
</div>

我试着做

@browser.div(:class, "cuke_business_group").checkbox.each{ |all| all.clear }
4

1 回答 1

7

你很亲密。尝试这个:

@browser.div(:class => "cuke_business_group").checkboxes.each {|checkbox| checkbox.clear}
于 2013-04-26T10:16:17.543 回答