wait for html element to be created to add a javascript event code example
Example: jquery wait for element to exist
var checkExist = setInterval(function() {
if ($('#the-canvas').length) {
console.log("Exists!");
clearInterval(checkExist);
}
}, 100); // check every 100ms