I'm quite new to javascript here. I'm trying to make a page which takes a url for a youtube video in a textarea, and passes that through to the video player object which then plays the video.
This is the code that I currently have (the textarea, the youtube video player (iframe), and the javascript.
<textarea id = "link" rows = "1" cols = "40" class = center>
Insert link here
</textarea>
<input type="button" value="submit" onclick="getLink()">
<div id="output">
<iframe width="420" height="315" src=output>
</iframe>
</div>
<script language="javascript" type="text/javascript">
function getLink() {
var url = document.getElementById("link").value;
console.log(url);
output.innerHTML = url;
}
<script>
When the submit button is hit, the player disappears and the text appears on the page, rather than changing the url in the youtube player and playing the linked video. What's going wrong here?