(function getCloseBox (){
let target = document.body;
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let mutation = new MutationObserver((mutations)=>{
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
if(document.getElementById("pb_layout")){
console.log("it is found");
}else{
console.log("it is not found");
}
});
let config = { attributes: true, childList: true,subtree: true ,characterData: true}
mutation.observe(target, config);
})();
here in the if statement I am checking for the element which will load after an ajax call in a website but in that website, this element is loaded but the mutation observer not found the change in the body. Executing else statement only and This functionality is for an extension so I don't have a access to ajax response. Please help