Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

101
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda