Executing JavaScript Within Data Element Syntax | Community
Skip to main content
Level 4
November 7, 2024
Question

Executing JavaScript Within Data Element Syntax

  • November 7, 2024
  • 1 reply
  • 431 views

I'm working on a new project and I came across this syntax:

%this.innerText%

in fields where a data element would be called. I thought it was a mistake, but my coworker told me that, it would execute the JS. I couldn't find any info online regarding this. I didn't know this was possible but if it is, how long has this functionality been available?

 

Thanks!

 

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

1 reply

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
November 11, 2024

HI @michaeljo13 

this cheat sheet by Jim Gordon should answer your question

https://jimalytics.com/wp-content/uploads/2017/11/Adobe-Launch-Cheat-Sheet.pdf

 

When you are appending click events to a link or button, you will automatically get the reference to the clicked element as this

Through this, you can apply the usual functions that you would get in the console using the result of a document.querySelector call.

 

 

Cheers from Switzerland!