Nazwa znacznika jQuery elementu

Próbuję uzyskać nazwę elementu w jQuery.

Mam następujący html:

<div class="section" id="New_Revision">

    <h1>New Revision&nbsp<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>

I javascript:

$(".edit").click(function(){
    $(this).closest("div.section").children().each(function(){
        alert($(this).tagName + " - " + $(this).html());
    });     
})

próbowałem$(this).tagName, $(this).nodeName i$(this).attr("tag") jak wspomniano w tym pytaniu:Czy jQuery może podać nazwę tagu?

Ale zawsze dostajęundefined w zamian. Thehtml() wyjścia poprawnie. Dlaczego nie mogę uzyskać nazwy tagu każdego elementu?

questionAnswers(2)

yourAnswerToTheQuestion