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

252
Views
How to access HTML element when I use module css

I am doing styling using module css and I wonder how I can access to an element with document.querySelector. It seems when I use module css, classname of an element is hashed so I can not access to the element by simply using document.querySelector('.some-classname'). I am not using any framework here so I can not use useRef.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When selecting an element by classNames you are getting an array of the elements even if the class name is only used one time.

Gives you the array of elements:

const elements = document.getElementsByClassName('className'); 

If you only have one element with this class you can style it like this:

elements[0].style.backgroundColor = "green";
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!