我已经经历了很多与此问题相关的主题,但无法获得所需的输出。如何使用jQuery处理iframe对象
我里面和HTML调用一个IFRAME这样的:
<iframe class="full-screen-preview__frame" id="nitseditpreview" src="himu/index.php" name="preview-frame" frameborder="0" noresize="noresize" data-view="fullScreenPreview">
假设在这个iframe中我有一个类名像这样的H2标签:
<body>
<section id="about-us">
<div class="container">
<div class="text-center">
<div class="col-sm-8">
<h2 class="maincontent">
Why with Us
</h2>
</div>
</div>
</div>
</section>
</body>
所看到的检查在浏览器中的元素
通过使用jquery我想操纵这个让我们说例如我想在这个边框。我已经尝试了很多事情,但我想如果有人修复了这个bug这件事情会的工作,我的jQuery看起来是这样的:
$(document).load(function() {
$('#nitseditpreview').load(function() { //The function below executes once the iframe has finished loading
$this = $(this);
$('#nitsmenu', this.contents()).css('border', 'solid 1px #777');
});
});
不知道我在做什么错误,即使我也遵循相同的原产地政策。
是内部或外部的伊夫兰运行JS? – Richard
iframe之外 –