checkbox to toggle div

I'm trying to show a div if a checkbox is selected. I got as far as:

<%= check_box('foo','temporary_bar',{:onclick => "Element.toggle('temp_bar'); return false;"}, 1, nil)%> <div id="temp_bar" style="display:none;"> <%= text_field 'foo', 'temporary_bar_details' %> </div>

The div toggles fine when clicking on the checkbox but it doesn't stay checked. Any help is appreciated.

H

Hi Hugh

If you remove the 'return false;' from your onclick handler, it should work as you want it to.

Cheers