addEventListener( 'myevent', function(){ alert( "executed myevent" ); }, false ); var e = document.createEvent( 'Events' ); e.initEvent( 'myevent', false, false ); dispatchEvent( e );