I am looking to extend jQuery so I can easily retrieve the tagName of the first element in a jQuery object. This is what I have come up with, but it doesn\'t seem to work:>
You may wish to add a toLowerCase() to make it more consistent (and XHTML compliant).
$.fn.tagName = function() { return this.get(0).tagName.toLowerCase(); } alert($('#testElement').tagName());