I have some ecommerce javascript that inserts additional html into my page once loaded. What I am trying to do is append that ecommerce html with more of my custom html. I have identified the specific ecommerce element that I want to append to and wrote the below code, but it doesn't seem to be able to locate the element. The code just continues to loop, even after the ecommerce html is loaded. What am I missing here.
var intervalId;
function checkForShopButton() {
intervalId = window.setInterval(updateShopButton, 500);
}
function updateShopButton() {
if ($(".pricing").length) {
clearInterval(intervalId);
$(".pricing").append("<div>Review And Buy</div>");
}
}
window.onload = checkForShopButton();