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

DTM Rule based Event Handler

Avatar

Avatar
Validate 1
Level 1
nelson_dalmeida
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
nelson_dalmeida
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
nelson_dalmeida
Level 1

15-10-2015

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 3
Level 2
shawncreed1
Level 2

Likes

3 likes

Total Posts

25 posts

Correct Reply

12 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile

Avatar
Boost 3
Level 2
shawncreed1
Level 2

Likes

3 likes

Total Posts

25 posts

Correct Reply

12 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile
shawncreed1
Level 2

15-10-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

Answers (0)