This will return the tag name of a container's first child:

$('#container > *')[0].tagName;

Hope it's useful!

Chuck Harmston
http://chuckharmston.com

On Tue, Apr 7, 2009 at 11:37 AM, bart <b...@ivwd.nl> wrote:

>
> Hello all,
>
> Let's say I'd have a div#content and I'd like to figure out what the
> first child of this div is. It could be an anchor, a paragraph, a
> heading who knows... I know the :first-child selector but this doesn't
> do what I want to accomplish as it just filters within the matched
> selector for the first child.
>
> Ultimately I'd like to figure out what element this first-child is. I
> can do this with .is() right?
>
> var $el = xx.is('h2'); //if it indeed matches a h2, returns true?
>
> Anyone willing to help out?

Reply via email to