Excellent.  Funny it seems like such a common task when you think about it 
though I've never needed it before and given the verbosity of the solution it 
seems not many other people have need it either :-P
 
Anyways thanks again you saved my sanity.
 
James.

________________________________

From: jquery-en@googlegroups.com on behalf of Richard D. Worth
Sent: Thu 22/01/2009 09:39
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Is A Child Of?


My first thought was to try these and neither worked

$(b, a).length

a.find(b).length

Also, no luck here

$(b[0], a[0]).length

a.find(b[0]).length

In the end this is the one I could get to work

$(b).parents().filter(function() { return this === a[0]; }).length

- Richard


On Thu, Jan 22, 2009 at 4:25 AM, James Hughes <j.hug...@kainos.com> wrote:




        Hi,
        
        This is probably a really easy question an I apologise if it appear 
stupid but I am clueless right now.  Given 2 jQuery objects (a,b) how can I 
tell if b is a child of a?
        
        James <http://www.kainos.com/> 
        
        
        



--------------------------------------------------------------------
This e-mail is intended solely for the addressee and is strictly confidential; 
if you are not the addressee please destroy the message and all copies. Any 
opinion or information contained in this email or its attachments that does not 
relate to the business of Kainos 
is personal to the sender and is not given by or endorsed by Kainos. Kainos is 
the trading name of Kainos Software Limited, registered in Northern Ireland 
under company number: NI19370, having its registered offices at: Kainos House, 
4-6 Upper Crescent, Belfast, BT7 1NT, 
Northern Ireland. Registered in the UK for VAT under number: 454598802 and 
registered in Ireland for VAT under number: 9950340E. This email has been 
scanned for all known viruses by MessageLabs but is not guaranteed to be virus 
free; further terms and conditions may be 
found on our website - www.kainos.com 


Reply via email to