Get selected element type
<p>I want to get the type of element, that I've got selected using jQuery selectors.</p>

<p>Markup:</p>

<pre><code>&lt;select name="a"&gt;&lt;/select&gt;
&lt;input name="b" type="text" /&gt;
&lt;textarea name="c"&gt;&lt;/textarea&gt;
</code></pre>

<p>Javascript:</p>

<pre><code>var field_names = new Array(
    'a',
    'b',
    'c'
);

for(var i = 0; i &lt; field_names.length; i++) {
    var field = $('[name=' + required_fields[i] + ']:visible');

    // ?????
    // What do I write here to get one of those outputs:
    //    Element with name a is &lt;select&gt;
    //    Element with name b is &lt;input&gt;
    //    Element with name c is &lt;textarea&gt;

    alert('Element with name ' + required_fields[i] + ' is ' + element_type);
}
</code></pre>
