<body>
<form id="form1" runat="server">
<div>
<input id="vdo" />
</div>
<div>
<button id="btn">Click</button>
</div>
<div id="fnl">
</div>
<script>
$(document).ready(function () {
$("#btn").click(function (e) {
e.preventDefault();
var url = $("#vdo").val();
var youtubeUrl = url.match(/watch\?v=([a-zA-Z0-9\-_]+)/);
var source="http://www.youtube.com/embed/" + youtubeUrl[1];
output = '<iframe width="420" height="420" src="'+source+'" frameborder="0" allowfullscreen></iframe>';
$("#fnl").html(output);
});
});
</script>
</form>
</body>
Hope this will help
Cheers
Pradeepa Achar
Comments