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

105
Visualizações
I would like to use the querySelector with a chrome extension

I would like to use the querySelector but it does not work. I think I need to put a word in the permissions but I can't find it. It's also possible that my code is bad I'm a beginner in js (If you have something to optimize my code I won't say no ;) ) I am making a calculator and I would like to know when I click on a number.

var debugmyextension = 7;
const one = document.querySelector(one);

one.addEventListener('click', event => {
    var debugmyextension = 2;
});

const two = document.querySelector(two);
const three = document.querySelector(three);
const four = document.querySelector(four);
const five = document.querySelector(five);
const six = document.querySelector(six);
const seven = document.querySelector(seven);
const eight = document.querySelector(eight);
const nine = document.querySelector(nine);
const zero = document.querySelector(zero);

my manifest file :

 {
    "name": "multi-jeu",
    "description": "de Jean Heubel",
    "version": "1.0",
    "manifest_version": 3,

    "background": {
      "service_worker": "/js/app.js"
    },

    "permissions": [
      "background",
      "storage",
      "clipboardWrite",
      "clipboardRead"
    ],

    "action": {
      "default_popup": "index.html",
      "default_icon": {
        "16": "/img/Capture d’écran 2021-09-07 122140.png"

      }
    },
    "icons": {
      "16": "/img/Capture d’écran 2021-09-07 122140.png"

    }
 }

my error message :

js/app.js:2 (fonction anonyme) :

const one = document.querySelector(one);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Well, we don't have your HTML, but let me explain querySelector, if you have a class in HTML and you want to use it in Javascript, then do document.querySelector('.class-name') "class-name is for example the name of your class", for an id, you would do document.querySelector('#id-name'),for a whole element you would do document.querySelector('body') "body is the element that you want to import" you can see it as you style elements in css.

here is some documentationthat can be helpful

about 4 years ago · Juan Pablo Isaza Relatório
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