Hi Bruce are trying to do something like an accordion.....
http://jqueryui.com/demos/accordion/ I tried to do what you described a few days ago and then found the jquery UI at the above link..... On Aug 12, 10:00 am, Bruce MacKay <b.mac...@massey.ac.nz> wrote: > Hi folks, > > I have a set of 3 divs with a class element of "hideme". Through > the code that follows (it's not mine; it works!), I can click a > dedicated a.tag for each div to toggle the visibility (or not) of the > contents of the associated div. > > What I'd like to be able to achieve is that if say, div#1 was visible > and the user clicked the a tag for div#2, then div#1 would disappear > and div#2 appear in its place. > > The code in the inserted line #5 allows me to achieve this slightly, > but it requires the associated a tag link to be double clicked in > order for their associated div to become visible and the currently > visible div to be hidden. > > I'd appreciate someone illuminating a path to a solution for me. > > Thanks/Bruce > > 1 $('#fsheet').find('.hideme').hide().end(); > 2 $('a.showme').each(function(i) { > 3 var $match = > $('div.hideme').eq(i); > 4 $(this).toggle(function() { > 5 // $('div.hideme:not(eq(i))').hide('slow'); > 6 $match.show('slow'); > 7 }, function () { > 8 $match.hide('slow'); > 9 } > 10 ); > 11 });