JSFiddle - React, Tailwind, and code Playground
HTML
<div id="main">
</div>
JavaScript
$(document).ready(function () {
var par = "I'm the problem";
var replacer = new RegExp("'", "g");
var new_btn = $('<button onclick="clicker(\'' + par.replace(replacer, "\\'") + '\');">ASDF</button>');
$("#main").append(new_btn);
});
function clicker(param) {
alert(param);
}