tags:

views:

46

answers:

2

If this is an HTMLDivElement, how do I avoid doing this ?

$('#' + $(this).id + " > p").foo();

to do something like :

($(this) + $( " > p")).foo();
+9  A: 
$(this).children('p').foo();
interjay
I was hoping to concatenate more in the string, but for this children would do.
Phonethics
You can use `.find` to select any descendants matching a selector, if you don't want direct children.
interjay
+3  A: 

Try this:

$(this).find("> p").foo();
zaius