title: jquery count select inputs matching required value
body: <p>I have a (django-generated) form with the following content:</p>
  
  <pre><code>&lt;form action="./" id="my_form" method="post"&gt;
  ...
  &lt;select name="object_0_status" id="id_object_0_status"&gt;
  &lt;option value=""&gt;---------&lt;/option&gt;
  &lt;option value="1"&gt;Online&lt;/option&gt;
  &lt;option value="2"&gt;Offline&lt;/option&gt;
  &lt;option value="3"&gt;Unknown&lt;/option&gt;
  &lt;/select&gt;
  &lt;select name="object_1_status" id="id_object_1_status"&gt;
  &lt;option value=""&gt;---------&lt;/option&gt;
  &lt;option value="1"&gt;Online&lt;/option&gt;
  &lt;option value="2"&gt;Offline&lt;/option&gt;
  &lt;option value="3"&gt;Unknown&lt;/option&gt;
  &lt;/select&gt;
  &lt;select name="object_2_status" id="id_object_2_status"&gt;
  &lt;option value=""&gt;---------&lt;/option&gt;
  &lt;option value="1"&gt;Online&lt;/option&gt;
  &lt;option value="2"&gt;Offline&lt;/option&gt;
  &lt;option value="3"&gt;Unknown&lt;/option&gt;
  &lt;/select&gt;
      ...
  &lt;/form&gt;
  </code></pre>
  
  <p>I am writing a custom validation method (using the JQuery Validations plugin <a href="http://docs.jquery.com/Plugins/validation" rel="nofollow">http://docs.jquery.com/Plugins/validation</a>) that is cross-checking different entries on the form. In order to do this, I need to retrieve the number of select boxes which have their selected value set to '1' (e.g. online).</p>
  
  <p>The select boxes are generated by a form factory, so there will be a variable number of them. There are also other select options on the form which should not be counted - just the ones ending '_status'.</p>
  
  <p>What's the cleanest way of doing this?</p>
  
  <p>Thanks</p>