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

234
Views
How to create css class in imported css file with vanilla javascript

i want to figure out how to add new class to css file, when i've got that file imported into javascript:

import "./styles.css"

//add class to that file

I don't want to insert new file to 'link' tag, only to modify that imported file

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

0

You will need to create the CSS class in styles.css and then using javascript add that class to the HTML element. You can also add new data attributes using javascript as shown in the image below, like this:

yourElement.dataset.myDatasetName = 'datasetValue';

Read all about how to use data-* attributes here: https://javascript.plainenglish.io/quick-guide-to-using-data-attributes-f1f2c3161d5f

Adding new dataset attribute

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!