Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

DTM Rule based Event Handler

nelson_dalmeida
Level 1
Level 1

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?

1 Accepted Solution
shawncreed1
Correct answer by
Level 3
Level 3

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

View solution in original post

1 Reply
shawncreed1
Correct answer by
Level 3
Level 3

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

View solution in original post