- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
06-28-2016 11:22 AM
I've got a link like <a href="/blah/Blech/Foo/120987/"> and I'm trying--with a "jQuery onHandler (1.7 and above)"--to select it on mouse down. The minor issue being that the final digits in the href fluctuate, so I want any As w/ HREFs containing '/blah/Blech/Foo/'.
The jQuery selector I'm using in TealiumIQ is $('a[href*=\"/blah/Blech\/Foo/\"]') - and this works in the chrome dev console when tested like this:
$('a[href*="/blah/Blech/Foo/"]').on('mousedown',function(){ console.log('that element is clicked') ; })
but somehow the quotes get messed up - once published, the chrome console comes back after the click with:
Uncaught Error: Syntax error, unrecognized expression: $("a[href*="/blah/Blech/Foo/"]")
whether or not I escape the single quotes, or the double quotes, or both. That is not the way I set up the selector. Any ideas?
Solved! Go to Solution.
06-28-2016 11:53 AM
So I have just tried the same thing:
Just to confirm you only need the select, and not the full jQuery snippet.
Adrian
06-29-2016 10:19 AM
Copyright All Rights Reserved © 2008-2023