Thank you all very much for replying. Mauricio's code worked for me :)

var el = $('#continer *:first').is('h2');
alert(el); // returns true if first child is H2, false otherwise

Again, thanks! :)

On Apr 7, 10:04 pm, Eric Garside <gars...@gmail.com> wrote:
> I think I understand what you want. Try this:
>
> $('#content :first-child')[0].tagName.toLowerCase(); // Will return
> "a" if it's an anchor, "div" for a div, "img" for an image tag, etc.
>
> On Apr 7, 12:37 pm, "Mauricio \(Maujor\) Samy Silva"
>
> <css.mau...@gmail.com> wrote:
> > > var $el = xx.is('h2'); //if it indeed matches a h2, returns true?
>
> > --------------------------------------------------------
> > var el = $('#continer *:first').is('h2');
> > alert(el); // returns true if first child is H2, false otherwise.
>
> > Maurício

Reply via email to