【发布时间】:2013-12-13 07:14:00
【问题描述】:
我正在尝试做一些非常简单的事情,但它只是不起作用。我试图在 iFrame 内的页面加载时显示 div。如果我查看 html 页面本身,则会显示 div。有谁知道 iFrame 中的 jQuery 可能存在的任何问题?如果我执行 alert() 它也会显示。
我的基本代码如下:
对 iFrame 的引用
<li>
<iframe src="/Markup/Page2.htm" marginheight="0" marginwidth="0" frameborder="0"></iframe>
</li>
Page2.htm 中的 HTML
<div class="Container">
<p class="ShowThis" style="display:none;">Show me on load</p>
</div>
Page2.htm 中的 jQuery
$(document).ready(function () {
$('.ShowThis').show();
});
【问题讨论】: