I want to call a function after an element has been created. Is there a way to do this?
Example:
$(\"#myElement\").ready(function() {
// call the
You can use setInterval function to check the existence of an element. Once the function runs, you can clear the interval:
var CONTROL_INTERVAL = setInterval(function(){
// Check if element exist
if($('#some-element').length > 0){
// ...
// Since element is created, no need to check anymore
clearInterval(CONTROL_INTERVAL);
}
}, 100); // check for every 100ms