jQuery tag name of element
问题 I'm try to get an elements tag name in jQuery. I have the following html: <div class="section" id="New_Revision"> <h1>New Revision <img alt="Lock_closed" class="edit" data-id="1" src="/assets/lock_closed.svg" /></h1> <p>This is a test paragraph.</p> <ol class="references"> <li>test</li> </ol> </div> And javascript: $(".edit").click(function(){ $(this).closest("div.section").children().each(function(){ alert($(this).tagName + " - " + $(this).html()); }); }) I've tried $(this).tagName , $