Erik,

Thank you very much...what a great answer!

Clears it all up for me plus more! It was in fact, the case that 'li/label'
wasn't working at all. So, thanks to your suggestion, i've moved to using
'li > label'.

Thanks again!

Jay.


Erik Beeson wrote:
> 
>> $('form.formclass').find('li/label').each(....
> 
> 
> That means "all LABEL tags that are a direct descendant of a LI tag that
> is
> a child of a FORM tag with the class 'formclass'."
> 
> $('form.formclass').find('li label').each(....
> 
> 
> "All LABEL tags that are a child of an LI tag that is a child of a FORM
> tag
> with the class 'formclass'."
> 
> The former will match:
> 
> <form class="formclass"><fieldset><ul><li><label for="...">...
> 
> But not:
> 
> <form class="formclass"><fieldset><ul><li><div><label for="...">...
> 
> Since the LABEL is no longer a direct descendant of the LI. The "li label"
> version would match either.
> 
> Note that find() is working about the same as the space, so you could
> write:
> 
> $('form.formclass li label') or $('form.formclass li/label')
> 
> Also note that as of 1.2, I think li/label doesn't work at all anymore
> without the XPath plugin. The preferred syntax is now "li > label" instead
> of "li/label". The preferred syntax will also work with older versions.
> 
> --Erik
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Selecting-elements-using-%27-%27-tf4441602s15494.html#a12673505
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to