 <p>Your fiddle illuminates the actual issue:</p> <pre><code>content = "&lt;input type='button' value='Add' onclick='addme(\"" + addedTitle + "\")' /&gt;" document.getElementById("display").innerHTML = content; </code></pre> <p>The problem is that the above code will generate the following:</p> <pre><code>&lt;input type='button' value='Add' onclick='addme("some'string")' /&gt; </code></pre> <p>You'll notice this has a single quote inside of your <code>onclick</code> which is single quoted. This is what is breaking. You can escape the single quote with <code>\</code>. </p> <p>However, a better approach would be to get rid of the inline <code>onclick</code> and do it this way:</p> <pre><code>var input = $("&lt;input type='button' value='Add'/&gt;").click(function(){ addme(addedTitle); }); $("#display").append(input); </code></pre> <p><a href="http://jsfiddle.net/bxxmhe03/6/" rel="nofollow">http://jsfiddle.net/bxxmhe03/6/</a></p>