title: jQuery - how to form field type?
body: <p>I have a situation where I need to extract a value from a form field, but I'm not sure what type it is (<code>&lt;input /&gt;</code> or <code>&lt;select /&gt;</code>). Two questions:</p>
  
  <ol>
  <li>Is there a simple way to detect what type of input this is (name of tag or something)?</li>
  <li>Is there an API call that retrieves the value or selected option's value for either an input or a select (thus not making me find out which is what)?</li>
  </ol>
  
  <p><code>var input = $('.form-field')[0];</code></p>
  
  <p><code>// for &lt;input&gt; type tags</code></p>
  
  <p><code>var value = $(input).val();</code></p>
  
  <p><code>// for &lt;select&gt; tags</code></p>
  
  <p><code>var value = $(input).find('option:selected').val();</code></p>
  
  <p>Thanks.</p>