Unidentified problem with jQuery's .click() function
<p>I'm trying to add an 'onclick' function to an image with jQuery and for some reason it's not sticking. My code looks like:</p>

<pre><code>//create arrow icon/button for li
var img = $('&lt;img&gt;&lt;/ &gt;').attr('id',i+5)
                       .attr("src","images/16-arrow-right.png")
                       .addClass("expImg")
                       .click(function(){expand(this, 'tdb', 'years', 'danwoods')})
                       .appendTo(li);
</code></pre>

<p>and the resulting  element looks like;</p>

<pre><code>&lt;img id="6" src="images/16-arrow-right.png" class="expImg"/&gt;
</code></pre>

<p>It completely leaves out the onclick function, but everything else works fine. Does anyone see a problem with my code, or does the error lie elsewhere? Thanks in advance...</p>
