I'm programming a web page for math tasks and want to set up a button which is generated dynamically, but my code generates '=" instead of " on the html page.
function generateButton(id){
var b = "<button onclick='copyToClipboard(" + id + ", 'de');'>Copy to Clipboard </button>";
$('#knopfdiv').append(b);
}
HTML
<div>
<button onclick='generateButton(1);'>Show Button</button>
</div>
<div id="knopfdiv"></div>
So I expect the html line
<button onclick='copyToClipboard(1, 'de');'>Copy to Clipboard </button>
but I get
<button onclick="copyToClipboard(1, " de');'="">Copy to Clipboard </button>
and so that button does not work. What's wrong here?