how to include a second "onclick event"
I have a website under Joomla and I need to include the follow code:
...inside the follow code of a specific php file:
onClick="_gaq.push(['_trackEvent', 'Link', 'Click', 'ListingClaimButton']);"
I tried several combination but none work and I get always an error. This is probably due to the fact another "Onclick event" is present in the code and I do not see how to include it correctly...
return '<span id="jr_claimImg'.$listing_id.'" class="jrButton jr_claimListing" title="'.__t("Claim This Business", true).'" onclick="s2Alert(\''.__t("Please register to claim this business",true).'\');">'. __t("Claim This Business", true).'</span>';
Unfortunately I do not have any PHP knowledges so is not easy...
Somebody have an idea about the correct syntax to use ???
thank for any suggestions
You can only have one onclick attribute, you just need to separate the function calls within the attribute.
onclick="s2Alert(\''.__t("Please register to claim this business",true).'\'); _gaq.push(['_trackEvent', 'Link', 'Click', 'ListingClaimButton']);"
thank for reply...
Yes I have already try this code but this don't work and give me an error...
I'm not sure but I suspect is the code I try to include need to be adapted because the single quote present here:
..give some problem...
'_trackEvent', 'Link', 'Click', 'ListingClaimButton'
Or maybe it seem is because the PHP code is a bit unusual (for what I see because on some place the developer have add some backslash before quote) and is not possible to add my own Onclick Event without making some adaptation...
Have you some more suggestions please ?
Ah yeah, sorry, if this is in a single-quoted PHP echo statement, just stick \ before all the ' like this:
_gaq.push([\'_trackEvent\', \'Link\', \'Click\', \'ListingClaimButton\']);
excellent it seem it was the solution because I don't get any more error. I just hope now the inclusion of my second Onclick Event will work like expected...
thank a lot for your help...you made my day .-)
all the best
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)