I have been setting up JQuery Onhandlers using "jquery selector" alt tag names for images. I noticed tracking will not work if an alt tag name has special characters. Is there a way to fix this issue without changing the alt name of the image?
In order to make sure that the resulting utag.js file is syntax error-free, the jQuery extension will only allow one type of quotes to be used in the selector field, which makes it tricky in cases where you really do want to use a single quote/apostrophe in your selector.
To represent "Dave's wooden ladders", you would do:
alt="Dave\u0027s wooden ladders"
When this gets evaluated in your browser, your browser will execute the unicode command and will see this as the original text "Dave's wooden ladders".
I hope this helps.
I just set up a demo page showing this in action, and it does work, but you need to be careful about the types of quotes you are using. It seems that the screenshot in my previous answer was incomplete. Here's a new screenshot:
Here is a demo page showing it in action:
If you click on the "Suits" button at the top of the page, this will trigger the jQuery onHandler extension, which in turn triggers an alert to show that you have clicked the button.
The full code for the jQuery handler, assuming it is an anchor (<a>) element, is:
a[alt="What\u0027s New in Suits!"]
\u0027 represents the single quotation mark in unicode.
Let me know if you have any trouble implementing this.