Javascript checkbox selection order
<p>How would I go about detecting the order in which checkboxes are checked?  I have a list of checkboxes on a form, and I need to have users select their first and second choices (but no more).  So, given this:</p>

<pre><code>&lt;input name="checkbox1" type="checkbox" value="a1"&gt; Option 1
&lt;input name="checkbox1" type="checkbox" value="a2"&gt; Option 2
&lt;input name="checkbox1" type="checkbox" value="a3"&gt; Option 3
&lt;input name="checkbox1" type="checkbox" value="a4"&gt; Option 4
</code></pre>

<p>If someone selects option 2, then option 3, I'd like to have some indicator that option 2 was the first choice, and option 3 was the second choice.  Any ideas?</p>

<p>Thanks in advance.</p>

<p><strong>Update:</strong></p>

<p>These are extremely helpful suggestions, thank you.  As I test these examples, it's giving me a better idea of how to approach the problem - but I'm still a bit stuck (I'm a JS novice).  What I want to do is have these labels change as the checkboxes are checked or unchecked, to indicate which is the first or second selection:</p>

<pre><code>&lt;label id="lblA1"&gt;&lt;/label&gt;&lt;input name="checkbox1" type="checkbox" value="a1"&gt; Option 1
&lt;label id="lblA2"&gt;&lt;/label&gt;&lt;input name="checkbox1" type="checkbox" value="a2"&gt; Option 2
&lt;label id="lblA3"&gt;&lt;/label&gt;&lt;input name="checkbox1" type="checkbox" value="a3"&gt; Option 3
&lt;label id="lblA4"&gt;&lt;/label&gt;&lt;input name="checkbox1" type="checkbox" value="a4"&gt; Option 4
</code></pre>

<p>So if someone clicks Option 2, then Option 3, lblA2 will display "First", and lblA3 will display "Second".  If someone unchecks Option 2 while Option 3 is still checked, lblA3 becomes "First".  Hopefully this makes sense?</p>

<p>Thanks!</p>
