Try the "this" keyword blg002 <[EMAIL PROTECTED]> wrote: I'm relatively new to jQuery & Javascript and was wondering if someone could help me condense my code a little.
What I have going on is... multiple div's with different info in them & an ordered list of links. Only one of the divs will display at a time and they can be toggled through by clicking on the corresponding link. HTML: Lorem Ipsum One Lorem Ipsum Two Lorem Ipsum Thre 1 2 3 JQuery: $("#branding ol li:nth-child(1) a").click(function() { $("#branding div").attr('id', 'one'); }); $("#branding ol li:nth-child(2) a").click(function() { $("#branding div").attr('id', 'two'); }); $("#branding ol li:nth-child(3) a").click(function() { $("#branding div").attr('id', 'three'); }); Here is a quick demo page... http://demonstration.dev.matrixgroup.net/brad/toggle/ Thanks for any help, brad --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.