I am trying to write my first RJS script to uncheck
all radio buttons in a div #network_radio_btns
page.select('#network_radio_btns input').each do |element|
element.set_attribute('checked', 'false')
end
I tested the loop : alert(index) and I can see all indexes but ...
how can I change an option ?.... not the value
I'd probably just render a new partial rather then trying to reset the button. If you really need to go this route, I think the visible properties of a radio button depend on the value being nil for unchecked. So you might need to add
maybe i'm missing something, but why would you need to do this using
rjs? from your example, you're making a call to the server, which is
returning javascript to uncheck all the checkboxes in a div. why not
just use straight javascript and skip the server altogether?
assuming all the checkboxes are in a form element, you can do
something like this (requires prototype):