jQuery: Data on dynamic div's
<p>In jQuery, I'm creating several div elements within a class:</p>

<pre><code>function class([..])
{
  this.par1 = par1
  [..]

  // Create div
  $div = $('&lt;div&gt;&lt;/div&gt;')
  $div.attr({
    'id': 'someid' + this.par1,
    [..]
  })

  // Assign data to $div
  $div.data['par1'] = this.par1
  $div.data['this'] = this

  // Append to document
  $('#container').append($div)
}
</code></pre>

<p>The problem I have is that both <code>.data['par1']</code> and <code>.data['this']</code> are always the same when using firebug to get <code>$('#someid1')</code> e.g.</p>

<p>I also tried first adding it to the document, and later bind the data (after re-getting the jQuery object)</p>

<p>What am I doing wrong?</p>
