Uncaught SyntaxError: Unexpected token }
<p>I have a piece of jQuery code which appends an input button to the body and then assigns an onclick function to it. The function that is meant to be called has been defined elsewhere and takes two arguments which are variables that have been defined just before.</p>

<p>This is the code I'm currently using:</p>

<pre><code>$("body").append("&lt;input type='submit' value='foo' onclick='foo(\'" + argument1 + "\',\'" + argument2 + "\'/&gt;");
</code></pre>

<p>However, when I try to click on the button, I get an error (in Chrome) saying: Uncaught SyntaxError: Unexpected token }.</p>

<p>Can anyone help me?</p>
