Passing event data to jQuery live handler
<p>I ran into a problem when I try to pass event data to jQuery live function. Basically, I have a table generated with many rows and each row data is encapsulated by an object, let's just call is "tbRow". I'd like register a live function on each row, and when you click on it, it will act differently based on the row data. The way I am structuring the code is as follows:</p>

<pre><code>MYAPP.prototype.actions = function (tbRow) {
   var output = "&lt;div class="select"&gt;&lt;a href="#"&gt; Select this row &lt;/a&gt;&lt;/div&gt;"
   $('div.select').live('click', {tbRow: tbRow}, function() {
       console.log(e.data.tbRow.id + "is selected");
       /// do something else
   });
   return output;
};
</code></pre>

<p>The output returned by this function is used to construct the actual table, and at the same time, a live function is registered for that row to respond to the click action. The print for id (assuming each row has a unique ID) is just for checking I am selecting the right row.</p>

<p>The problem I ran into is that every row I select now carry the ID of FIRST row, it appears only the first one gets registered properly. One way I can think of to resolve it is, to make a concatenated string with row ID, such that:</p>

<pre><code>$('div.select_RowID1").live( .... )
</code></pre>

<p>However, I am not sure if this will work or right approach.</p>

<p>Thanks in advance for help.</p>

<p>Oliver</p>
