I'm writing html in Javascript using innerHTML, in one case, I'm appending a href tag like so :
txt.innerHTML += '<a href="" id="rssLinks" onclick="goToUrl(' + url + ');">Read more</a>';
where url is a string containing a url.
And the goToUrl function looks like as follows :
function goToUrl(urlToBrowse) {
window.open(urlToBrowse, "_blank");
}
But my onclick never gets called, can anyone see the problem? Cheers
alertyour string.