DTM Rule based Event Handler | Community
Skip to main content
October 16, 2015
Solved

DTM Rule based Event Handler

  • October 16, 2015
  • 1 reply
  • 1611 views

I have created an onClick Event Based Rule in Adobe DTM and clicked the “Apply event handler directly to element”.

My CSS Selector is “div.mainTopNav a , a.InfoLinkItem”.

 

I want to access the clicked anchor tag’s href and text value, but I do not know how to reference the object of the clicked event and it’s corresponding element in the Custom Code Page.

Please could you help me with this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by shawncreed1

You would simply use 'this' in custom code to reference the object that was targeted by the rule.  So, for example, if you wanted to get the title attribute of the link referenced in your example above, you could use custom code like:

var linkTitle = this.getAttribute("title");

Hope this helps!

-Shawn

1 reply

shawncreed1
shawncreed1Accepted solution
Level 3
October 16, 2015

You would simply use 'this' in custom code to reference the object that was targeted by the rule.  So, for example, if you wanted to get the title attribute of the link referenced in your example above, you could use custom code like:

var linkTitle = this.getAttribute("title");

Hope this helps!

-Shawn