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

177
Views
¿Cómo agregar un atributo a una imagen con una clase específica o texto alternativo js/jquery?

Necesito agregar un atributo a imágenes específicas usando JS o jQuery, pero no puedo resolverlo.

Estoy usando WordPress y las imágenes a las que quiero agregar el atributo están dentro de un control deslizante, por lo que no puedo agregar ninguna clase a esas imágenes.

Traté de agregar el atributo que quiero usando la clase de contenedor para buscar imágenes, pero no funcionó.

 $('.dce-img > img').attr('rlskip', '1');

Así quiero que sea:

 <div class="dce-item"> <figure data-image-ratio="0.5" class="dce-img dce-fit-img"> <img src="../img/F4D13DA3-5351-4F69-8C33-0A1EF3BFDF67.webp" alt="Demo_ts_2" rlskip="1"> </figure> </div>

¿Me pueden ayudar a encontrar una solución, por favor? Tengo que agregar el atributo rlskip a las imágenes del control deslizante aquí.

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

0

El problema es que $ no está definido. Cambie $ a jQuery como a continuación:

 jQuery('.dce-img > img').attr('rlskip', '1');
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!