0

I use an external consent tool on my webseite (inmobi choice). The tool is loaded with an async javascript and opens a window on my website to ask for consent.

Is it somehow possible to change text with javascript or jquery in this javascript generated consent tool window?

I am able to change texts in my local website for example with document.getElementsByClassName("myClass")[0].innerHTML = 'new text'; or $(".myClass").text('new text');

But that does not work in the javascript generated window of the consent tool.

The javascript window of the consent tool looks like this

<div class="qc-cmp2-container" id="qc-cmp2-container" data-nosnippet="">
 <div class="qc-cmp2-main" id="qc-cmp2-main" data-nosnippet="">
 <div id="qc-cmp2-ui" role="dialog" aria-label="qc-cmp2-ui">
 [...]
 <div class="qc-cmp2-consent-info">
 Text to be changed...
 <div>
 <div>
 <div>
<div>

With console.log(document.getElementsByClassName("qc-cmp2-consent-info")); I can see the text in the console, but was not sucessfull to change it.

HTML Collection []{
 0: div.qc-cmp2-consent-info
 1: {scrollfalse: f}
 ...
 innerHTML: "Text to be changed..."

For example $(".qc-cmp2-consent-info").text('new text'); shows no change

asked Feb 18, 2024 at 12:23
1
  • Is the consent HTML content injected as an iframe? Commented Feb 18, 2024 at 13:48

1 Answer 1

0

Have you tried using $(".qc-cmp2-consent-info").val('new text'); ?

answered Feb 18, 2024 at 12:47
Sign up to request clarification or add additional context in comments.

1 Comment

$(".qc-cmp2-consent-info").val('new text'); does not change the text in the consent window.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.