It's probably due to the fact that you're only allowed one id on the page at a time, $('#example') should only ever return one element, which is probably why $('#example:eq(1)') isn't working
There's more on this here: http://www.tizag.com/cssT/cssid.php Rik 2008/12/15 Guengoeren <guengoe...@acocon.de>: > > > Hi Guys, > > gotta problem here and i don't know why it occurs: > > Example: > Simple Html Page > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html> > <head> > <meta http-equiv="content-type" content="text/html; charset=windows-1250"> > <meta name="generator" content="PSPad editor, www.pspad.com"> > <title></title> > <script type="text/javascript" src="js/jquery.js"></script> > </head> > <body> > > <script type="text/javascript"> > jQuery.noConflict(); > jQuery(document).ready(function() { > alert( jQuery('#test:eq(1) > a:eq(0)').attr('href') ); > }); > </script> > > <div id="test"> > http://www.test.de test > </div> > <div id="test"> > http://www.test2.de test > </div> > </body> > </html> > > if '#test:eq(0) > a:eq(0)' is set, it returns the right href value. But when > I change it to '#test:eq(1) > a:eq(0)' I only get "undefinied" from my alert > box. > > Can anyone explain me why? I dont get it, maybe I'm doing a big mistake in > my "little" code. > > thx a lot > -- > View this message in context: > http://www.nabble.com/-jQuery--eq%28%29-driving-me-nuts...-tp21022666s27240p21022666.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > > -- Rik Lomas http://rikrikrik.com