- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
05-05-2016 08:51 AM
trying to get a mousedown event and using a jquery selector for the event.
href attribute doesnt seem to work as I have it written.
this doesnt fire as far as I can tell.
a[href$="item.pdf"]
05-05-2016 09:11 AM
Hi @paul_elwood,
I performed a simple test and it appears that the selector does work as you have described.
The following line was added to a test HTML page:
<a href="http://thisplace.com/item.pdf"">test href</a>
Then in the Console, added the following jQuery statement to test your selector:
jQuery('a[href$="item.pdf"]').on('mousedown',function(){
console.log('element with item.pdf clicked') ;
})
When clicking on the link "test href" on the test page, the message "element with item.pdf clicked" displayed.
Can you provide some additional detail? Are you seeing any errors? Are you attempting this through an onHandler extension?
Thanks, David
05-05-2016 10:42 AM
yep, should work.
using clickhandler 1.6+
DOM ready
selector is a[href$'"thompson_truck_case_study.pdf"]
trigger onMousedown
I tried with the other version of jquery but was not successful there either.
the link is valid.
I think the problem may be the way the selector is written in the selector field?
05-05-2016 10:46 AM
Just a quick note, there is no equal sign in that selector, should read
a[href$="thompson_truck_case_study.pdf"]
Could that be the issue?
05-05-2016 01:28 PM
works fine!! thanks.
I am embarrassed to tell you that I filtered myself out of the GA reporting. Duncecap for me this afternoon
<;-(
thank you !!
05-05-2016 01:43 PM
LOL. No worries! Just glad you got it solved.
Copyright All Rights Reserved © 2008-2023