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

97
Views
Apply CSS ID via JavaScript

I'm going to apply all of these CSS effects to another image via JavaScript code by selecting images that have that CSS effect.

#grayscale { filter: grayscale(1); }

#sepia { filter: sepia(1); }

#invert { filter: invert(1); }

#blur { filter: blur(2px); }

#saturate { filter: saturate(2); }

#contrast { filter: contrast(2); }

With this code, the number of commands increases and I want to write much shorter:

document.getElementById('#yourId').style.property = new style;

Inside the event

const handleFilter = (e) => { const { target } = e; const { id: filter } = target; // filter: "grayscale" | "sepia" | "invert" | "hue-rotate" | "contrast" | "saturate" | "blur"

};
about 4 years ago · Juan Pablo Isaza
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!