How can I use JavaScript to update the src value of an iframe based on input?
<input class="url" id="url1" type="url" value="youtube url">
<input onclick="changevideo()" class="add-video" id="add-video1" type="submit" value="add to playlist">
<iframe class="video" id="video1" ></iframe>
<script>
function changevideo() {
var newUrl = document.getElementById('url1').value;
document.getElementById('video1').setAttribute('src', newUrl);
}
</script>