Всем привет! Изучаю создание расширения для Гугл и не могу понять, почему скрипт не может найти элемент во всплывающем окне, которое появляется при клике на иконку этого расширения. В варианте ниже я получаю null
в консоль. Подскажите, пожалуйста.
manifest.json
{
"manifest_version": 2,
"name": "Payuot from test account",
"description": "Payout extantion for test account.",
"version": "0.1",
"browser_action": {
"default_title": "Simulation payout",
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"content_scripts": [
{
"matches": ["https://*.com/*"],
"js": ["popup.js"]
}
],
"permissions": [
"activeTab",
"storage"
]
}
popup.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
body {
width: 150px;
height: 15px;
}
</style>
</head>
<body>
<label><input id="check" type="checkbox" /> Payout on/off </label>
<script src="popup.js"></script>
</body>
</html>
popup.js
function checkedConfirme() {
const checkbox = document.getElementById('check');
console.log(checkbox);
}
checkedConfirme();
popup.html
никак не удается. – Илья 16 янв '18 в 8:27