I want to get the child tag name of an element.
HTML:
<div class="element">
<h1>title</h1>
</div>
<div class="element">
<img src="http://2.bp.blogspot.com/-ma66w8WJsZ0/UBVcmt3XS4I/AAAAAAAAAWw/4UyVd2eR8A0/s1600/olympic-logo.thumbnail.jpg" />
</div>
<div id="debugger"></div>
jQuery:
$(".element").bind("click", function(){
var child = $(this).add("first-child").prop("tagName");
$("#debugger").html(child);
});
I don't understand why I'm always getting DIV as the result...
Thank you.