I tried the above solution and as I suspected it doesn't work. The link is not between double quotes which means when you click on it, goes to nowhere.
Here is a best version so far:
function EJEJC_config() {
EJEJC_POSTCALL=true;
}
function EJEJC_shown() {
jQuery("#tdPmnt").attr("innerHTML",
"<a onclick='javascript: ejGATracker.trackPageview('/TermsConditionsCheckout');' href='/Portals/5/Downloads/Other/Terms and Conditions.pdf' target='blank'>terms & conditions</a>");
}
As you can, there are several single quotes used. When I use the following, the link works and opens up in a new page, but tracking doesnt work.
The reason is that the single quotes here all get converted to double quotes which is good for the correct functioning of the HTML. When passes our text between <a> and </a> will be converted to:
<a onclick="javascript: ejGATracker.trackPageview("/TermsConditionsCheckout");" href="/Portals/5/Downloads/Other/Terms and Conditions.pdf" target="blank">terms & conditions</a>
However, the following single quotes also get converted:
ejGATracker._trackPageview('/TermsConditionsCheckout')
making it look like this:
ejGATracker._trackPageview("/TermsConditionsCheckout")
which is wrong.
I think these need to stay as single quote. Hence, my question is how can we pass single quotes to the jQuery.attr function. Suggestion: can we pass two single quotes next to each other like this.
ejGATracker._trackPageview(''/TermsConditionsCheckout'')
or how about this?
ejGATracker._trackPageview(\'/TermsConditionsCheckout\')
Thanks