jQuery Quote Issue with Function in OnClick
<p>Here's my code:</p>

<pre><code>jQuery("#"+code+"_2").after("&lt;a href='#' id='"+code+"_3' onclick='addfunction('"+code+"', event); return true;'&gt;&lt;img src='special.gif' border='0'&gt;&lt;/a&gt;");
</code></pre>

<p>I'm getting a syntax error on addfunction(. The code is a string and I tried wrapping it in quote, but it doesn't work. Any ideas?</p>

<p>UPDATE --- This works, but doesn't pass the code and event over in the function.</p>

<pre><code>function addfunction() {
alert("THIS WORKS");
}
var myAnchor = $('&lt;a href="#" id="' + code + '_3"&gt;&lt;img src="special.gif" border="0"&gt;&lt;/a&gt;').bind('click', addfunction);
$('#' + code + '_2').after(myAnchor);
</code></pre>
