Reputation: 1229
i know this is a simple question, but i can't get this syntax to render properly for me in my onclick event when doing this in code;
else{
hhResults = hhResults + "<a href='#' onClick='window.open(\'/applications/app360/dashboard.aspx?vchAcctKey=&ihhid=" + this.ID + "&tcn=&icfnaccountid=');'>" + this.displayText + "</a>";
My syntax is wrong below i just want to add the window.open in the onClick event of the anchor tag, i've been trying for 25 minutes and can't get it to render correctly.
Currently in chrome it renders like this;
<a href="#" onclick="window.open(" applications="" app360="" dashboard.aspx?vchacctkey="&ihhid=978089&tcn=&icfnaccountid=');'">BEVILACQUA, FRANK & MARJORIE</a>
Upvotes: 0
Views: 109
Reputation: 59252
Firstly, know how to escape the quotes. Either you can escape them by interchanging the single and double quotes or escape them by prefixing the quote by a backslash \
.
Secondly, its a Bad IdeaTM to use inline js.
Upvotes: 1