 <p>Try this for your jsfiddle:</p> <pre><code>function toggleMe(me) { var alreadyOpen = me.is(':visible'); jQuery('div[class^="content-"]').hide('fast'); if (!alreadyOpen) { me.show('slow'); } } jQuery('.expand-one').click(function() { toggleMe(jQuery('.content-one')); var img = $(this).find('img'), src = img.attr("src"), alt = img.data("altsrc"); img.attr("src", alt).data("altsrc", src); }); /// SECOND SESSION: ///////////////////////////////////////////////////////////////////////////////////// jQuery('.expand-two').click(function() { toggleMe(jQuery('.content-two')); var img = $(this).find('img'), src = img.attr("src"), alt = img.data("altsrc"); img.attr("src", alt).data("altsrc", src); }); </code></pre> <p>Hope this helps,</p> <p>Pete</p>