0

Many times we just need to use simple jQuery on checkout page but checkout element bind with knockout js so our jQuery does not work smoothly. So, how can we call jQuery after bind element??

1

Below is a way to call your jQuery after bind 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");
});

hope this helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.