Javascript Listener for a Modal?
Hey hey. Im experimenting with creating a javascript listener for a pendo guide.
The idea is that when a modal opens, [class^="createAlbum_modal__"], then the pendo guide would appear.
That modal can appear on one of a dozen pages. I want to create a Sitewide guide, and then add the listener into the guides custom code javascript.
So far I have this:
function checkElement() {
var element = document.querySelector('[class^="createAlbum_modal__"]');
if (element) {
pendo.showGuide('hgPwGQ8OKxYm_qZVmwBGp1yqiJs');
}
}
setInterval(checkElement, 1000);
However I am 1000% sure Ive messed up the if (element) section. Could anyone lend me a hand?
Thank you!
Comments
Try adjusting that section to this:
Please sign in to leave a comment.