Attach data or array index to anchor tag
<p>I have some javascript/jquery code that dynamically populates an unordered list with a bunch of list items.  In the list items I have a link and I want to associate some data with that link which is generated like so:</p>

<pre><code>var thing1 = { name: 'My Object' };
var thing2 = { name: 'My Other Object' };
var li = $('&lt;li&gt;&lt;/li&gt;&lt;br /&gt;');
var aSel = $('&lt;strong&gt;' + thing1.name + '&lt;br /&gt;&lt;a class="btn btn-mini btn-success addDeal" href="javascript:void(0)"&gt;&lt;i class="icon-plus"&gt;&lt;/i&gt;Add Deal&lt;/a&gt;';
li.append(aSel);
li.append(add);
$('#sidebar').append(li);
//This is in a loop so the same thing would happen with thing2, etc
</code></pre>

<p>would generate HTML like so:</p>

<pre><code>&lt;div id="results"&gt;
    &lt;ul id="sidebar"&gt;
        &lt;li&gt;
            &lt;strong&gt;My Object&lt;/strong&gt;&lt;br /&gt;
            &lt;a class="btn btn-mini btn-success addDeal" href="javascript:void(0)"&gt;&lt;i class="icon-plus"&gt;&lt;/i&gt;Add Deal&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;strong&gt;My Other Object&lt;/strong&gt;&lt;br /&gt;
            &lt;a class="btn btn-mini btn-success addDeal" href="javascript:void(0)"&gt;&lt;i class="icon-plus"&gt;&lt;/i&gt;Add Deal&lt;/a&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>So if the user clicks the first Add Deal link, I want to work with the <code>thing1</code> data elsewhere in my script.  If they second link is clicked on, I want to work with the <code>thing2</code> data.</p>

<p>The path I'm going down involves an array and some code that doesn't feel quite right to me.  I figure I'm missing something trivial.</p>
