// checking if breadcrumb contains "RENTALS" if so remove approve button var breadcrumbs = document.querySelectorAll(' .breadcrumb-link.breadcrumb-text'); var approve_button = document.querySelector('[approve-model]'); var remove = false; setTimeout(()=>{ breadcrumbs.forEach(function(item, index) { var text = item.textContent; if (text.indexOf('RENTALS') != -1) { if (approve_button) approve_button.remove(); remove = true; // console.log(approve_button); } }); },500); // if (remove){ // var approve_button_watcher = document.querySelector('.product-details'); // const approve_button_observer = new MutationObserver(function() { // console.log('finding and removing'); // approve_button = document.querySelector('[approve-model]'); // approve_button.style.display = "none"; // }); // approve_button_observer.observe(approve_button_watcher,{subtree: true, childList: true}); // }