When you embed a movie from youtube, you have the opportunity to change the width and height of the iframe element. When you type in your desired values, you see that the html code inside the texarea is changed so the user can just copy paste.
How do you make this happen?
This is what I tried:
<input type="text" id="width">
<textarea id="code">
<iframe src="..." width="224" height="144" frameborder="0" id="embed-widget"></iframe>
</textarea>
<script>
$(function() {
$('#width').keyup(function(){
var new_width = $(this).val();
$('#embed-widget').attr('width',new_width);
});
});
This don't work inside the textarea, but the exact same code work on the iframe element itself on the page (when I put the id on to it)
Also, is there a easy way to make the whole text marked when the user clicks the text area?