jquery - how to select for this, get a count, and get the current position within the selected group
<p>I have a set of img boxes that are marked up like this</p>

<p>I want to get a count and have this:</p>

<pre><code>&lt;div data-location-id="6" class="img-box-set"&gt;my img&lt;/div&gt;
</code></pre>

<p>I have:</p>

<pre><code>var location_id = $(this).data('location-id');
// fixed per comment #1 below
var count_of=$('.img-box-set[data-location-id='+location_id+']').length;
alert("here is count_of" + count_of);
</code></pre>

<p>but the length always returns 0. Am I doing something wrong with selector or with length property?</p>

<p>Also, assuming I have 4, how would I determine which position I'm in (either 0-based or 1-based)?</p>

<p>thx</p>

<p><strong>edit #1</strong>
So I'd think this works but it isn't (per @jack ) and index docs. (update - this does work; had syntax error)</p>

<pre><code>var index_box=$('.img-box-set[data-location-id='+location_id+']').index(this);
alert("here is the index" + index_box); 
</code></pre>
