The .prop() function is a nice way of doing this.
// Very jQuery
$('#mydiv').prop('tagName');
// Less jQuery
$('#mydiv')[0].tagName;
Both give the same result.
And, as Aram Kocharyan commented, you'll probably want to standardise it with .toLowerCase().