KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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: $.fn.tagName = function() { return this.each(function() { return this.tagName; }); } alert($('#testElement').tagName()); Any ideas what's wrong? BTW, I'm looking to use this more for testing than in production.
Tags (comma-separated)
Save Edits
Cancel