Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
How to add an attribute to an image with a specific class or alt text js/jquery?

I need to add an attribute to specific images by using JS or jQuery, but I can't figure it out.

I'm using WordPress and the images that I want to add the attribute are inside a slider, so I cannot add any class to those images.

I tried to add the attribute that I want by using the container class to find images, but it didn't work.

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

This how I want it to be:

<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>

Can you help me to find a solution please? I have to add the rlskip attribute to the images of the slider here.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The problem is that $ is not defined. Change $ to jQuery like below:

jQuery('.dce-img > img').attr('rlskip', '1');
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda