我已經經歷了很多與此問題相關的主題,但無法獲得所需的輸出。如何使用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之外 –