Count elements that the id begins with a certain string
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/897025/jquery-return-elements-where-id-begins-with-a-certain-string">jQuery Return elements where ID begins with a certain string</a>  </p>
</blockquote>



<p>Ok, let's say I have the following elements:</p>

<pre><code>&lt;select id="state_id" value="20"&gt;test1&lt;/select&gt;
&lt;select id="state_id1" value="21"&gt;test2&lt;/select&gt;
&lt;select id="state_id2" value="22"&gt;test3&lt;/select&gt;
</code></pre>

<p>How can I get the <code>length()</code> of the select tags that the id begins with <code>state_id</code> in this case?</p>

<p>I have tried: <code>$("^#state_id").length();</code> but no success.</p>

<p>Any hint?</p>
