Thanks, That works fine, although the check not displaying is an annoyance and I haven't tried to figure that one out.
After posting I found this and it works well for me $(document).ready(function(){ $('#content div').hide(); $("#showAll").click(function(){ if ($("#showAll").is(":checked")) { $("#content div").show('slow'); } else { $("#content div").hide('slow'); } }); On Oct 24, 7:41 pm, Duncan Heal <[EMAIL PROTECTED]> wrote: > Hey > > JS: > $(document).ready(function() { > $('.detail').hide(); // hide detail div > > $('#showAll').toggle(function(){ > $('.detail').show(); > },function(){ > $('.detail').hide(); > });} > > ); > > HTML: > <input type="checkbox" title="Show All Fields" id="showAll" > name="showAll" value="showAllFields" class="showAll" /> > <label for="showAll">Show All Fields</label> > > <h2>What’s New/Press Release Display Areas</h2> > > <div class="detail"> > <p>blah blah blah</p> > </div> > > I've found toggle to be a good way of doing this type of > thing.http://docs.jquery.com/Events/toggle#fnfn > > This will show/hide all divs with the class of detail. If you want to > have the content slowly reveal rather than suddenly appear, use show > ("slow"). > > Greater minds will tell you why the checkbox doesn't become selected > once clicked. I'd like to know myself. > > Duncan > - - - - - - - - - - - - - > Sprocket Web Designwww.sprocket.co.nz > - - - - - - - - - - - - - > > On 25/10/2007, at 7:51 AM, blg002 wrote: > > > > > I have and "Show All Fields" checkbox that I want to show all the divs > > within an <div id=content> - ('#content div'). The input has a class > > of showAll. How do i write the code so that it displays all the divs > > when check and hides them all again when unchecked. > > > Thanks for your help. > > > <input type="checkbox" title="Show All Fields" id="showAll" > > name="showAll" value="showAllFields" class="showAll" /> > > <label for="showAll">Show All Fields</label> > > > <div id="content"> > > <div> > > <h2>What’s New/Press Release Display Areas</h2> > > </div> > > > <div > > > <h2>Full Text</h2> > > </div> > > </div>