I have the following jQuery code:
$(".container").append("<a href='javascript:void(0)'onClick='showField('"+data.name+"','"+data.text+"');'>Edit</a>");
Which is outputting (notice the quote problem before the 4 and before the >edit: 
<a href="javascript:void(0)" onclick="showField("4','school_type');'>Edit</a>
When it should be outputting:
<a href="javascript:void(0)" onclick="showField('4','school_type');">Edit</a>
                try \" instead of ' in onClick: 
$(".container").append("<a href='javascript:void(0)' onClick=\"showField('"+data.name+"','"+data.text+"');\">Edit</a>");
                        You need to escape your "s with \
$(".container").append("<a href='javascript:void(0)' onClick='showField(\""+data.name+"\",\""+data.text+"\");'>Edit</a>");
Live DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With