- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
01-11-2016 02:11 PM - edited 01-11-2016 02:12 PM
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?
01-12-2016 09:49 AM - edited 01-12-2016 10:27 AM
Try adding a backslash before the special character in the alt tag e.g. [alt="jon\'s alt tag"]
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.
04-13-2016 01:36 PM - edited 04-13-2016 02:06 PM
Hi @christina_schel! For some reason this procedure is not working for me.
04-13-2016 01:37 PM - edited 04-13-2016 02:08 PM
Hi @craig_rouse! I tried applying this method and it's not working for me.
What is the alt tag you are having trouble with?
The alt tag is What's New in Suits!
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.
04-15-2016 06:00 AM - last edited on 04-15-2016 10:58 AM by kathleen_jo
Copyright All Rights Reserved © 2008-2023