You could do two things ... write yourself a plugin that would look
something like this:

jQuery.fn.tag = function() {
  return this[0] ? this[0].tagName : null;
};

or you could just do it like this:

$('span').parent().get(0).tagName

--
Brandon Aaron

On 11/10/06, Laurent Yaish <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I couldn't find a way using jQuery to get the tagName of an element.
>
> Let's say I have this:
>
> <div><span>test</span></div>
> $('span').parent().tag() would return 'div'
>
> is that currently possible?
> I found the is() function, maybe that could be changed to return the tagname
> if no argument is passed
>
> Thanks!
>
> Laurent
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to