:::: MENU ::::

Magento Tutorial | Magento Blog | Learn Magento 2

Cookies Consent Popup

Sometime we just need to use simple jQuery on checkout page but checkout element bind with knockout js so our jQuery not work smoothly so below is a way to call your jQuery after bind perticular element.

Use below code in your jquery and it will load after binding your element in page.

function waitForElement(query, callback){
    var poops = setInterval(function(){
        if(document.querySelector(query)){    
            clearInterval(poops);
            callback();
        }
    }, 100);
}

waitForElement(".class", function(){
    alert("element is loaded.. do stuff");
});

0 comments:

Post a Comment