Streaming live at 10am (PST)

Show div block "ABC" IF DOM contains string "123"

I must display a div block on confirmation pages IF document contains text string “123”.

  • Div Block ABC is hidden by default
  • Div Block ABC must remain hidden IF the page document does NOT contain matching text string “123”
  • Div Block ABC must be displayed only IF the page document contains matching text string “123”.

Not to be confused with If contains ? query peram

I use this string for something similar on a seperate div.

let divs = document.getElementsByClassName('ABC');

for (let x = 0; x < divs.length; x++) {
    let div = divs[x];
    let content = div.innerHTML.trim();

    if (content == '123' || content == '456') { = 'none';