I'm working on a simple chrome extension that displays a string of text when the user opens a new tab. The code is:
<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="showText.js"></script>
</head>
<body>
<div id="textDiv">
<h1 id="actualText"></h1>
</div>
<div id="footer">
<img src="settings.png"/>
</div>
</body>
</html>
and the js file
document.addEventListener("DOMContentLoaded", function () {
var text = "sample text";
$('#actualText').append(text);
});
This doesn't seem to work when I open a new tab, but when I click refresh on the tab, the text shows up. So I'm guessing the first time the DOMContentLoaded event has already been fired before this code is run? That shouldn't be the case if I load it in the head though right? I'd appreciate any help!