Im trying to append html with a javascript string, but having some troubles with the single quotes.
Appending the element works this far:
$("<a class='action-button' id='pl65197buy' value='buy now'>Bekijk aanbieding</a>").prependTo("div#centerplist");
But when I try to add an onclick function it wont work - do i need to escape the quotes somehow?
onclick="buy(this, 65197, null, 'pl65197qty",null, '/ajax/buy'
This is obviously wrong but its the closest i get without an error in the console:
$("<a class='action-button' id='pl65197buy' value='buy now' onclick='buy(this, 65197, null, 'pl65197qty',null, '/ajax/buy'>Bekijk aanbieding</a>").prependTo("div#centerplist");