title: jquery get the value using class name
body: <p>I am trying to get the value of an input text field based on its class name through jquery.</p>
  
  <p>the HTML is:</p>
  
  <pre><code>&lt;form&gt;
    &lt;input type="text" id="datePicker" style="display: none;"&gt;
    &lt;div class="dp_wrapper dp_input_6"&gt;
      &lt;div class="dp_tagBox"&gt;
        &lt;span class="dp_tag dp_tag_day"&gt;11&lt;/span&gt;
        &lt;span class="dp_tag dp_tag_month"&gt;Jun&lt;/span&gt;
        &lt;span class="dp_tag dp_tag_year"&gt;2009&lt;/span&gt;
        &lt;input type="text"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;input type="button" onclick="GetContents()" value="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The jquery is:</p>
  
  <pre><code>var myValue=$('.dp_tag dp_tag_day').val()
  </code></pre>
  
  <p>But <code>myValue</code> is coming up undefined. Does anyone know why?</p>