Sam, >function toggleAllDetails (obj) { > if($(obj).attr('checked')) { // Hide the correct answers? > $('ol li div.quizsubheader').hide('fast'); > } else { > $('ol li div.quizsubheader').show('fast'); > }; >};
I'd use just hide()/show(). This won't give you the animation effect--but that could be the cause of your slowness. Also, if you might try modifying your selector to: $('div.quizsubheader') Also, once you find the fastest selector, make sure to cache it as a global variable. That way you don't have to run the selector each time. You can just used the cached jQuery object. var oQuizSubHeaders; $(document).ready( function (){ oQuizSubHeaders = $('ol li div.quizsubheader'); } ); function toggleAllDetails (obj) { if($(obj).attr('checked')) { // Hide the correct answers? oQuizSubHeaders.hide('fast'); } else { oQuizSubHeaders.show('fast'); }; }; Now the toggleAllDetails() function doesn't have to keep re-parsing the DOM to find the valid element. -Dan