Expand my Community achievements bar.

Executing JavaScript Within Data Element Syntax

Avatar

Level 2

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!

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Community Advisor

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.

 

bjoern__koth_0-1731308814815.png

 

Cheers from Switzerland!