Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!