如何使用jQuery在div中动态插入iframe?
$(document).ready(function() {
$("div").html("<iframe src='http://google.com'><iframe>");
});
我尝试了上面的代码,但它不能工作。
发布于 2010-07-13 19:05:26
您没有关闭iframe标记
<iframe>
</iframe>
发布于 2012-06-12 18:41:12
我像这样使用它,它工作得很好;-)
$(".div").html("<iframe width='850' height='450' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='http://yourlocation.com'></iframe>");
$(".div").css("display","block");
发布于 2010-07-13 19:02:14
实际的jquery代码看起来没有问题,您可能没有正确引用div。
#div - would be an element with the id "div"
.div - would be an element with the class "div"
https://stackoverflow.com/questions/3236430
复制相似问题