How to get the value from a class element?
<p>I am trying to get the selected class text.</p>

<p>I have</p>

<pre><code>for (var i=0; i&lt;$('.toys').length; i++){

       if($('.toys')[i].text()=='lego'){
         alert('got it');
         return false;
      }
    }
</code></pre>

<p>html</p>

<pre><code>&lt;div class='toys'&gt; toya  &lt;/div&gt;
&lt;div class='toys'&gt; lego  &lt;/div&gt;
&lt;div class='toys'&gt; toyb  &lt;/div&gt;
&lt;div class='toys'&gt; toyc  &lt;/div&gt;
</code></pre>

<p>I got an error saying the  Object # has no method 'text'</p>

<p>How do I fix this? Thanks for the help!</p>
