コミュニティアチーブメントバーを展開する。

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

Capturing sibling text of the clicked element through launch

Avatar

Community Advisor

We have a rule in Launch to capture a paragraph(".link.sl-cta.video") click in the DOM. We also want to capture the text present in sibling div when the paragraph is clicked. We tried the below custom code in the data element to get the sibling value. nothing works. Any help appreciated. Thanks


var text = $(this).parent().find(".content-block-heading").text();

console.log(text);
var text1 = $(this).siblings(".content-block-heading").text();

console.log(text1);

 

The rule is getting trigger when the link click happens

Saravanan_Dharmaraj_0-1664993301645.png

 

 

 

 

 

 

1 受け入れられたソリューション

Avatar

正解者
Community Advisor

Thanks for the reply. Plain javascript code didnt work.

 

Below one worked.

$(event.target).parent().find(".content-block-heading").text()

元の投稿で解決策を見る

3 返信

Avatar

Community Advisor

i also read https://jimalytics.com/tag-management/adobe-launch-data-elements-guide/#Custom_Code 

$(this) - wont work in launch, so we have to use the utilities.. Could anyone point me to the doc where the utilities are mentioned? Thanks

Avatar

Level 4

It looks like jQuery is missing. But you can do this via regular javascript 

 

this.parentElement.querySelector(".content-block-heading").innerText

Avatar

正解者
Community Advisor

Thanks for the reply. Plain javascript code didnt work.

 

Below one worked.

$(event.target).parent().find(".content-block-heading").text()