I'm looking for a way to detect a DOM mutation on a HubSpot page, more specifically the appearance of a pop-up form thank-you modal, with class = .leadin-thank-you-wrapper.
Has anyone been successful in doing something similar? Using MutationObserver?
Aug 21, 20201:13 AM - edited Aug 21, 20201:15 AM
Recognized Expert | Elite Partner
DOM modification detection
SOLVE
@danielelodola - I have looked for this functionality as well as a global javascript event library for leadin and it doesn't seem to exist... even combing through the javascript library yielded no results. What I am left doing is
var leadincheck = window.setInterval(function(){ if($(".leadin-thank-you-wrapper").length){ $('body').addClass('has-leadin-thank-you'); window.clearInterval(leadincheck) } }, 300);
I realize there is no elegance in this approach but it tends to get the job done
Aug 21, 20201:13 AM - edited Aug 21, 20201:15 AM
Recognized Expert | Elite Partner
DOM modification detection
SOLVE
@danielelodola - I have looked for this functionality as well as a global javascript event library for leadin and it doesn't seem to exist... even combing through the javascript library yielded no results. What I am left doing is
var leadincheck = window.setInterval(function(){ if($(".leadin-thank-you-wrapper").length){ $('body').addClass('has-leadin-thank-you'); window.clearInterval(leadincheck) } }, 300);
I realize there is no elegance in this approach but it tends to get the job done