我試圖更新iframe的內容,當具有相同ID的輸入更新時。jQuery函數更新輸入變化的iFrame內容
的iframe裏面的內容與 「預覽」
<span id="mainheadertext">This is the iFrame content</span>
輸入框問題的ID:
<input type="text" class="form-control" id="mainheadertext" name="mainheadertext">
我的jQuery:
$('input').on('input', function() {
$("#preview").contents().find($(this).attr("id")).html($(this).val());
});
我相信它與我的發現有關,但我似乎無法弄清楚。
謝謝!
我不認爲你可以影響一個iframe這樣的內容。 – DrCord