Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
Cannot link my extension's popup(html file) and javascript file using onclick()

I cannot link my extension's HTML file with JS.The output I was expecting was that h4 line would change into "not skipper". I have been trying onclick function, I read that I needed to use .addEventListener() but I couldn't make it work.

The webpage works when I test it as an actual webpage using live server but fails when i try to use it in an extension.

I wanted to know how to correct my onclick() mistake and how to use .addEventListener() for this code Manifest.json file

{
"manifest_version": 2,
"name": "Skipper",
"version": "1.0",


"description": "Does something",
"browser_action": {
  "default_icon": "stuff/potato.jpg",
  "default_popup": "popup.html",
  "default_title": "Skipper!"
},
"icons": {
  "48": "stuff/potato.jpg"
},
"permissions": [
  "activeTab"
 ],


"content_scripts": [
  {
    "matches": [""http://*/*","https://*/*"],
    "js": ["pop.js"]
  }
  ]


 }

This is my extension's HTML which is in proper directory

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Skipper</title>
</head>
<body>
    <h4 id="help">Skipper</h4>
    <button onclick="func()">Reload</button>
</body>
<script src="pop.js"></script>
</html>

This is my JS file

function func()
{
    var change=document.getElementById("line").innerHTML="not skipper";
    return change;
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda