get the tag name of the element
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1532331/can-jquery-provide-the-tag-name">Can jQuery provide the tag name?</a>  </p>
</blockquote>



<p>I want to display text inside the div tag in two different situations:</p>

<ol>
<li>When I hover over the first child element I want to see text as id and the name of the tag element.</li>
<li>When I hover over the other elements (not first child) I want to see the text "this not first child".</li>
</ol>

<p><a href="http://jsfiddle.net/centerwow/9TPtn/18/" rel="nofollow">Example</a></p>

<p>HTML:</p>

<pre><code>&lt;ul id="ul1"&gt;ul1
   &lt;li id="aa"&gt;1&lt;/li&gt;
   &lt;li id="bb"&gt;2&lt;/li&gt;
   &lt;li id="cc"class="elm"&gt;3&lt;/li&gt;
   &lt;li id="dd"&gt;4&lt;/li&gt;
   &lt;li id="ee"&gt;5&lt;/li&gt;
&lt;/ul&gt;
&lt;ul id="ul2"&gt;ul2
   &lt;li id="ul2-1"&gt;1&lt;/li&gt;
   &lt;li&gt;2&lt;/li&gt;
   &lt;li&gt;3&lt;/li&gt;
   &lt;li&gt;4&lt;/li&gt;
   &lt;li&gt;5&lt;/li&gt;
&lt;/ul&gt;&lt;br/&gt;

&lt;div&gt;element-name&lt;/div&gt;
</code></pre>

<p>CSS:</p>

<pre><code>div,li{ width:40px; height:40px; margin:10px;
        float:left; border:2px blue solid; 
        padding:2px; }
ul{ width:100px; height:10px; margin:10px;
        float:left; border:2px blue solid; 
        padding:2px; }
  span { font-size:14px; }
  p { clear:left; margin:10px }​  
</code></pre>

<p>jQuery:</p>

<pre><code>var $curr = $(".elm");
$curr.css("background", "#f99");

$("*:first-child")
        .css("background", "#cac")
        .hover(function () {
              $(this).css("background","green");

            $('div').text(this.id+$(this).tagname());

            }, function () {
              $(this).css("background", "#cac");
            });
</code></pre>
