I followed the steps to develop a Chrome extension from dev docs https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/
But my popup.js is not working, even loading the "hello world" extension example from documentation the scripts remains doing nothing.
My extension structure:
extension
├── images
│ ├── icon-128.png
│ ├── icon-16.png
│ ├── icon-32.png
│ ├── icon-48.png
│ └── icon-64.png
├── manifest.json
├── popup.css
├── popup.html
└── popup.js
Manifest.json
{
"manifest_version": 3,
"name": "My extension",
"description": "Extension example",
"version": "1.0",
"action": {
"default_popup": "popup.html",
"default_icon": "images/icon-48.png"
},
"icons": {
"16": "images/icon-16.png",
"32": "images/icon-32.png",
"48": "images/icon-48.png",
"128": "images/icon-128.png"
}
}
Popup.html
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<div class="cta-wrapper">
<button id="cta-btn" class="btn">CLICK ME</button>
</div>
<script src="popup.js"></script>
</body>
</html>
Popup.js
document.getElementById('cta-btn').addEventListener('click', function(e) {
console.log('Click')
})
I tried with a simple console.log in popup.js but do nothing. Any idea of what is happening?