[jQuery] find dd's dt

2007-03-29 Thread Alexandre Plennevaux
hello!
 
i guess i'm not too good in finding my way upwards in the DOM tree.
 
I have a structure like this:
 
dl#navigation 
dl#navigation  dt 
dl#navigation  dd  ul  li  a.selected
 
dl#navigation  dt 
dl#navigation  dd  ul  li  a 
 
dl#navigation  dt 
dl#navigation  dd  ul  li  a
 
/dl
 
all  ul are hidden but the one containing the selected a. I need to access that 
specific dt element.
 
i tried this, but it does not work:
 
$this = $(//dd[ul/li/a.selected]);
$this.show();
$this = $(this).parent();
$(dt,$this).css({border: 1px solid #FF});
 
 
sorry, i think i  'm in need of a good tutorial on selectors.
 
thank you for your help,
 
Alexandre
 
 
 


-- 
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.448 / Base de données virus: 268.18.20/737 - Date: 28/03/2007 16:23
 
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] find dd's dt

2007-03-29 Thread Klaus Hartl
Alexandre Plennevaux schrieb:
 hello!
  
 i guess i'm not too good in finding my way upwards in the DOM tree.
  
 I have a structure like this:
  
 dl#navigation
 dl#navigation  dt
 dl#navigation  dd  ul  li  a.selected
  
 dl#navigation  dt
 dl#navigation  dd  ul  li  a
  
 dl#navigation  dt
 dl#navigation  dd  ul  li  a
  
 /dl
  
 all  ul are hidden but the one containing the selected a. I need to 
 access that specific *dt* element.
  
 i tried this, but it does not work:
  
 $this = $(//dd[ul/li/a.selected]);
 $this.show();
 $this = $(this).parent();
 $(dt,$this).css({border: 1px solid #FF});
  
  
 sorry, i think i  'm in need of a good tutorial on selectors.
  
 thank you for your help,
  
 Alexandre

Alexandre, try this:

$(//dd[ul/li/a.selected]).prev();


I'm not sure if I understood that XPath selector correctly, but you 
could try:

$(//dd[ul/li/a.selected] ~ dt)

But I think that this one simply selects the dd element that is preceded 
by a dt which is the case anyway.


-- Klaus





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] find dd's dt

2007-03-29 Thread Jonathan Sharp

Or possibly something along the lines of

$('a.selected').parents('dd').prev()

-js



On 3/29/07, Alexandre Plennevaux [EMAIL PROTECTED] wrote:


 hello!

i guess i'm not too good in finding my way upwards in the DOM tree.

I have a structure like this:

dl#navigation
dl#navigation  dt
dl#navigation  dd  ul  li  a.selected

dl#navigation  dt
dl#navigation  dd  ul  li  a
dl#navigation  dt
dl#navigation  dd  ul  li  a

/dl

all  ul are hidden but the one containing the selected a. I need to access
that specific *dt* element.

i tried this, but it does not work:

$this = $(//dd[ul/li/a.selected]);
$this.show();
$this = $(this).parent();
$(dt,$this).css({border: 1px solid #FF});


sorry, i think i  'm in need of a good tutorial on selectors.

thank you for your help,

Alexandre





--
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.448 / Base de données virus: 268.18.20/737 - Date: 28/03/2007
16:23

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/