title: Getting correct index from input array in JQuery
body: <p>How do you get the proper index of a selected input from a set of input elements with irregularly numbered indexes using JQuery?  JQuery's "index" function always returns a value starting from 0 instead of the indexes I used.  My code is below:</p>
  
  <p>JQuery:</p>
  
  <pre><code>$("input[name^=myboxes]").click(function() {
          var element_id = $("input[name^=myboxes]").index(this);
          alert(element_id); //will alert 0, 1, or 2 instead of 3, 8, or 10
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input type="checkbox" id="myboxes[3]" name="myboxes[3]" value="CHECKED"  &gt;
  &lt;input type="checkbox" id="myboxes[8]" name="myboxes[8]" value="CHECKED"  &gt;
  &lt;input type="checkbox" id="myboxes[10]" name="myboxes[10]" value="CHECKED" CHECKED &gt;
  </code></pre>
  
  <p>Thank you!</p>