Kenneth B Kenneth B - 6 months ago 43
jQuery Question

jQuery: Direct child of $(this)

Is it possible to, somehow, select a direct child of $(this)?

I have:

var obj = $(this);
$("ul", obj).css('width',s*w);


And need it to act like this:

obj > "ul"


Is it possible?

Answer

$(this).children('ul') returns a list of direct children.