window.onYouTubePlayerReady = function(playerId) { ytplayer = document.getElementById(playerId); alert(ytplayer); }