Setting an attribute in jQuery and then retrieving it
<p>I have </p>

<p><code>var results="&lt;div title='"+id+"'&gt;&lt;img src='"+thumb+"'&gt;&lt;/div&gt;";</code></p>

<p>I'm rendering this out to the page, and then later trying to retrieve the id variable. To do this, I have:</p>

<p><code>$("#results").click(function() { 
var id=$(this).attr("title"); });</code></p>

<p>Right now, id is returning as undefined. I think I'm not setting the attribute right in the first place. How do I do this correctly? Let me know if I need to provide more detail.</p>
