I'm trying to allow users to specify the height and width of an iframe. I would like to allow them to enter a height and width which would populate those values in a string wich they could copy and paste. I'm not sure how to pass that value to the string.
<form id="embed-customize" action="/" style="display:block">
<fieldset class="embed-size">
<legend>Size:</legend>
<div>
<input id="embed-width" type="text" value="300">
x
<input id="embed-height" type="text" value="500">
</div>
</fieldset>
</form>
<textarea id="embed-url" rows="3" cols="100"></textarea>
<script>
jQuery(document).ready( function() {
var embedWidth = "";
var embedHeight = "";
var iframe = "";
jQuery('#embedWidth').blur(function(){
embedWidth = jQuery(this).val();
})
var iframe = '<iframe width = ' + embedWidth + 'px height = ' + embedHeight +'px frameborder = "0" scrolling = "no" src = "http://www.example.com">"></iframe>';
jQuery('#embed-url').val(iframe);
})
</script>
This is what I have so far but it doesn't seem to work. I'm not sure what I'm doing wrong.
embed-widthbut in the javascript your using#embedWidth