I am having trouble trying to replace text within a p tag. I've tried a couple ways to get element by id and replace text but no luck. What am I doing wrong?
iframe.html
<div>
<p id="title">Tom Clancy</p>
</div>
Content.js
var iframe = document.createElement ('iframe');
iframe.src = chrome.extension.getURL ('iframe.html');
var topview = document.getElementById('sidebar-content');
topview.parentNode.insertBefore(iframe, topview)
What I Have Tried To Change Text:
iframe.getElementById('title').innerHTML = "Harry Potter";
and
iframe.contentWindow.getElementById('title').innerHTML = "Harry Potter";