Unable to access HTML element from external js in Chrome Extention
Hi I am learning to build Chrome Extensions and am very new to this field.
I am working on a very basic extension here and even before I have started
on the main task, I am stuck in my demo code. I simply wish to print
"hello" or any message in my paragraph tag when I click my extension.
Here is the HTML code:
<!DOCTYPE html>
<html>
<head>
<title>hi</title>
<style>
p
{
color:red;
font-size:20px;
}
</style>
<script src="getMSG.js"></script>
</head>
<body>
<p id='content'></p>
</body>
</html>
And here is the code for getMSG.js:
document.getElementById('content').innerHTML = 'Hello';
My extentsion was working just fine when I simply wrote "Hello World" in
my HTML code. But now when I do this I get no output at all. Please can
someone help with this? Thanks in advance :)
No comments:
Post a Comment