I use the following code to dynamically create an iframe.
var iframe_jquery = $(\"\") .addClass(\"foo\") .appendTo(container); // conta
The problem is that your won't be "real" until it's really added to the actual DOM for the page. Here is a fiddle to demonstrate..