document.querySelector('#my_area').addEventListener('load', function(){ aTestFunction(); }); function aTestFunction(){ return "called"; }