I\'m trying to add a canvas over another canvas – how can I make this function wait to start until the first canvas is created?
function PaintObject(brush) {
Another variation of Iftah
var counter = 10; var checkExist = setInterval(function() { console.log(counter); counter-- if ($('#the-canvas').length || counter === 0) { console.log("by bye!"); clearInterval(checkExist); } }, 200);
Just in case the element is never shown, so we don't check infinitely.