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)%>

<%= text_field 'foo', 'temporary_bar_details' %>

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


Pat

thanks heaps Pat this was exactly the answer I was looking for too!