I'm trying to do a simple show/hide. When a user clicks an a link, I want to hide the dd for that link. Any ideas why the .children() is not working?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Tabs 1</title> <style type="text/css"> .hide {display: none;} </style> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#tabs dd').addClass('hide'); $('dt a').click(function() { $(this).parent().children().removeClass('hide'); }); }); </script> </head> <body> <h1>Test 1</h1> <dl id="tabs"> <dt><a href="#one">tab 1</a></dt> <dd id="one"> <h2>Container 1</h2> <p>Random content.</p> </dd> <dt><a href="#two">tab 2</a></dt> <dd id="two"> <h2>Container 2</h2> <p>Random content.</p> </dd> <dt><a href="#three">tab 3</a></dt> <dd id="three"> <h2>Container 3</h2> <p>Random content.</p> </dd> </dl> </body> </html>