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

205
Views
¿Se puede crear un nuevo elemento HTML con un nombre de clase específico con JavaScript?

Estoy tratando de crear un elemento HTML con un nombre de clase específico para que cuando el contenido esté en el DOM, se le puedan aplicar los estilos CSS. ¿Es esto posible?

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

0

Simplemente cree el elemento e inserte la clase dentro de él.

Ex:

 // inside createElement function you have to type the tag name const element = document.createElement('div') element.classList.add('class-name') // then you need to insert the element inside any element you want ( for example body element ) document.body.appendChild(element)
about 4 years ago · Juan Pablo Isaza Report

0

como dijo @Mina, puede usar element.classList.add("myClass") .

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!