Referencing an elem without an ID but has an attr - how?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/696968/jquery-v1-3-2-find-element-by-attribute">jquery v1.3.2 find element by attribute</a><br>
  <a href="http://stackoverflow.com/questions/12823144/is-it-possible-to-grab-a-link-by-its-href-if-it-doesnt-have-a-class-or-id">Is it possible to grab a link by its href if it doesn’t have a class or ID?</a>  </p>
</blockquote>



<p>My question revolves around having an attribute to an element (can't use ID's as I can' be certain that those will be unique) - </p>

<p>for instance, I have this:</p>

<pre><code>&lt;a href="someurl.com"&gt;Link&lt;/a&gt;
</code></pre>

<p>but I can dynamically inject and could I possibly have a feasible/fast/efficient way of referencing this in the dom (keep in mind, there would be numerous links like this).</p>

<pre><code>&lt;a href="someurl.com" data-access-label="000998"&gt;Link&lt;/a&gt;
</code></pre>

<p>So, I will be reiterating thru a hash and curious if this would be fast/efficient?</p>

<pre><code>data = {
  '98789' : 'yeah',
  '871637':'cool',
  '00198789' : 'sure thing',
  '871609':'no way',
  '000998':'alright'
}
</code></pre>

<p>So, it seems inefficient to me that I would .each thru all the links then find the data-access-label value, and then what? could I possible bind those hrefs or something so that once I run my function - it would look like this</p>

<pre><code> &lt;div&gt;
   &lt;a href="someurl.com" data-access-label="000998"&gt;Link&lt;/a&gt; alright
       &lt;span&gt; &lt;a href="someurl.com" data-access-label="871637"&gt;Link&lt;/a&gt; cool&lt;/span&gt;
 &lt;/div&gt;
</code></pre>

<p>At any given time there will be only upwards of 40 items in the data hash, so perhaps I could ".each" thru it, and match the key with the value in those data-access-label ? But my want is perhaps directly accessing that item rather than reiterating thru href's too.</p>
