it should be possible to set an event using href

Silver Contributor
Silver Contributor

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"]

 

5 REPLIES 5

it should be possible to set an event using href

Tealium Employee

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  

 

it should be possible to set an event using href

Silver Contributor
Silver Contributor

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?

 

it should be possible to set an event using href

Tealium Employee

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?

it should be possible to set an event using href

Silver Contributor
Silver Contributor

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 !!

 

 

it should be possible to set an event using href

Tealium Employee

LOL. No worries! Just glad you got it solved.

Public